f



How to plot two set of data with same y-axis but different x-axis to the left and right of the y-axis

Hello,

How to plot two set of data with same y-axis but different x-axis.

One dataset to the left and one dataset to the right of the y-axis.
0
Tobias
11/3/2010 1:25:06 PM
comp.soft-sys.matlab 211264 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

5 Replies
1629 Views

Similar Articles

[PageSpeed] 7

Tobias Gram wrote:
> Hello,
> 
> How to plot two set of data with same y-axis but different x-axis.
> 
> One dataset to the left and one dataset to the right of the y-axis.

Look for the example of "Double Axis Graphs" in the online document...

--
0
dpb
11/3/2010 1:39:33 PM
dpb <none@non.net> wrote in message <iarovc$5a3$1@news.eternal-september.org>...
> Tobias Gram wrote:
> > Hello,
> > 
> > How to plot two set of data with same y-axis but different x-axis.
> > 
> > One dataset to the left and one dataset to the right of the y-axis.
> 
> Look for the example of "Double Axis Graphs" in the online document...
> 
> --

Hi again.... I have allready tried this way of dealing with the problem, but it doesn't work for me. Please look at this example i have here:

http://dl.dropbox.com/u/5162978/test.png

It is done in the program "Grapher"... But i want to do it in Matlab..

Best regards

Tobias Gram
Denmark, Copenhagen University
0
Tobias
11/4/2010 7:57:03 AM
Tobias Benjamin Gram wrote:
....

> Hi again.... I have allready tried this way of dealing with the problem, 
> but it doesn't work for me. Please look at this example i have here:
> 
> http://dl.dropbox.com/u/5162978/test.png
....

Would have to set the two axes origins at the same point and use the 
'xdir' property to reverse the direction of the one.  Other than that, 
seems fairly similar to the example in the online documentation.

What is "doesn't work"?

--
0
dpb
11/4/2010 1:26:49 PM
dpb wrote:
> Tobias Benjamin Gram wrote:
> ...
> 
>> Hi again.... I have allready tried this way of dealing with the 
>> problem, but it doesn't work for me. Please look at this example i 
>> have here:
>>
>> http://dl.dropbox.com/u/5162978/test.png
> ...
> 
> Would have to set the two axes origins at the same point and use the 
> 'xdir' property to reverse the direction of the one.  Other than that, 
> seems fairly similar to the example in the online documentation.
....

Try the following as a starting point...

ax1=axes('position',[0.1,0.1,0.45,0.8], ...
          'xaxisloc','top', ...
          'xdir','reverse', ...
          'yaxisloc','right');

Add the second axis similarly, then populate each as desired...

Or, given your desire to essentially have to plots side by side, you 
might be able to do something like...

plot(x,y)  % the lhs data
set(gca, 'position',[0.1,0.1,0.45,0.8], ...
          'xaxisloc','top', ...
          'xdir','reverse', ...
          'yaxisloc','right');

I just did the above w/ a sample dataset and works fine.  You'll have to 
play to get the rhs...

Good luck...

--
0
dpb
11/4/2010 2:20:51 PM
Tobias Benjamin Gram wrote:
....

> http://dl.dropbox.com/u/5162978/test.png
> 
....

OK, had a couple of minutes to play...one can even start w/ plotyy and 
probably get there...

 >> sigx=[.1 3.3];sigy=[.002 .057];  % make up some similar data
 >> epsx=[-.001 -0.022]; epsy=sigy;
 >> [ax,h1,h2]=plotyy(epsx,epsy,sigx,sigy);  % basic plotyy
 >> rect1=get(ax(1),'position');             % get default positions
 >> rect2=get(ax(2),'position');
 >> rect1(3)=rect1(3)/2;                     % cut lh width by half
 >> rect2(1)=rect1(1)+rect1(3);              % start of rh axis
 >> rect2(3)=rect1(3);                       % same width
 >> set(ax(1),'position',rect1)              % and resize both
 >> set(ax(2),'position',rect2)
 >> set(ax(1),'ydir','reverse'), set(ax(2),'ydir','reverse')
 >> set(ax(1),'xlim',[-0.08 0])
 >> set(ax(1), 'xaxisloc','top','yaxisloc','right')  % set axis loc
 >> set(ax(2), 'xaxisloc','top','yaxisloc','left')
 >> set(ax(2),'box','on','color',[1 1 1])    % bounding box, bkgd
 >> set(ax(1),'ytick',[])
 >> set(ax(2),'xtick',[0:4])
 >> set(ax(2),'ytick',[0:0.01:0.05])
 >>

I did the above mostly one at a time so could observe the effects; 
nothing says you can't string a bunch of the properties together in a 
single set() call for each of the axes.

Or, of course, you could avoid some of the modifications by using the 
line() and axes() directly as the example pointed to previously does.

Anyway, that's a shot at the base figure; annotation and the other line 
and so on shouldn't be hard from here.

Salt to suit...good luck.

--
0
dpb
11/4/2010 7:37:57 PM
Reply:

Similar Artilces:

How to plot two set of data with same y-axis but different x-axis to the left and right of the y-axis #2
Hello, How to plot two set of data with same y-axis but different x-axis. One dataset to the left and one dataset to the right of the y-axis. ...

How can I plot two curves with two different y-axis (placed at right and left) with one reverse-logarithmic x-axis?
How can I plot two curves with two different y-axis (placed at right and left) with one reverse-logarithmic x-axis? Something like this BUT with a reverse x-axis for both curves: x = 0:0.01:20; y1 = 200*exp(-0.05*x).*sin(x); y2 = 0.8*exp(-0.5*x).*sin(10*x); [AX,H1,H2] = plotyy(x,y1,x,y2,'semilogx'); Thanks! "Amir " <albalbaloo@gmail.com> wrote in message <hrbv10$3ti$1@fred.mathworks.com>... > How can I plot two curves with two different y-axis (placed at right and left) with one reverse-logarithmic x-axis? > > Something like this BUT wit...

How can I plot two different y-axis (right and left) with a reverse-logarithmic x-axis?
Let us look at this example: x = 0:0.01:20; y1 = 200*exp(-0.05*x).*sin(x); y2 = 0.8*exp(-0.5*x).*sin(10*x); [AX,H1,H2] = plotyy(x,y1,x,y2,'plot'); Now how can one reverse x-axis and at the same time in logarithmic scale? Even using (Tools>Edit plot>Property edittor>Axis) in Figure window is not giving controls on axis of second data sets (x,y2) plot here! ...

two tendencies plot for the left Y axis and one bar plot for the right axis ?
Hi all, I am wondering if you can provide some solutions. How to draw two tendencies plot for the left Y axis and 1 bar plot for the right axis? Thank you very much. Michael "Kuo-Hsien" <mchangks@hotmail.com> wrote in message news:i7vgc8$33h$1@fred.mathworks.com... > Hi all, > > I am wondering if you can provide some solutions. How to draw two > tendencies plot for the left Y axis and 1 bar plot for the right axis? Use PLOTYY with six input arguments, the fifth being the handle to the function that draws the "two tendencies" plot and the sec...

one scatter plot with 2 x axis and 2 y axis, one of the x axis being a function of the first x axis
Hello to all! I'm trying to do a Hertzsprung-Russell diagram like this one: http://en.wikipedia.org/wiki/File:HRDiagram.png If you see, the temperature (top x axis) is not a linear function of the color (bottom x axis), and i cant find a way to do this. My code: % to read the stars data: filename = 'Hipparcos_stars2.xlsx'; sheet1 = 1; xHRcolor = 'G2:G19934'; yHRmag = 'I2:I19934'; xHRtemp = 'J2:J19934'; yHRlum = 'K2:K19934'; HRx_c = xlsread(filename, sheet1, xHRcolor); HRy_m = xlsread(filename, sheet1, yHRmag); HRx_t = 10.^(3.9396...

Plotting three different data sets using two different y-axis
Hello, I want to plot three data sets on a single axis using two different y-axis. Specifically, I want to plot two data sets using the errorbar. These values range between 80-100, for this two plots I want to have the y-axis on the left. Second, I want to plot a bar display on the SAME subplot using the bar command, but for the y-axis of the bar to be on the right, here the values range between 0-2.5. Can anyone help me with making this plot? Thank you :) ...

matlab figure/axis properties / more properties/ x axis and y axis shifting
i want to shift the x axis and y axis of my matlab figure in the centre of the plot without disturbing the plot pattern. i want to know what the new values of the new data would be? also i want to do this using matlab. i saw that in matlab there is axis properties option, but they are like, x axis option : top and bottom and y axis option as : left and right , thats all. how can i get them at centre. plz explain anybody. --shahnaz On 4/19/2012 12:46 PM, shahnaz fatima wrote: > i want to shift the x axis and y axis of my matlab figure in the centre > of the plot without...

Two x axis and two y axis on imagesc
Hey. I'v got a 2d array of data that i plot using the code seen below. I need there to be two x axis and two y axis (top and button - left and right). The x axis's are multiple of eachother. I need "vectorX1" and "vectorY1" to be the 2nd axis's. See my code her: imagesc(Array) vectorX = X(1:column); vectorY = zeros(row,1); stepsize = 0.047625*10^(-6); %vectorX = (vectorX - mean(vectorX))*stepsize*10^3; %vectorY = (vectorY - mean(vectorY))*stepsize*10^3; map = colormap; the_min = min(min(Array)); the_max = max(max(Array)); img = round(64*(Array...

plotting data points with numerical y-axis and a string x-axis
I've got 8 1x2 vectors that I would like to plot. The first value in each vector belongs to the 'x90' category and the second value belongs to the 'xnovib' category. I'd like the x-axis to have two "values".... namely 'x90' and and 'xnovib'. The y-axis will be scaled to the numerical inputs in each of the 8 vectors. How can I plot this with a line joining the two points from each vector considering that the y-axis is numerical and the x-axis is a string. Thanks in advance Farid "Farid Medleg" <farid.medleg@gmail.com> w...

bar same X-axis two Y axis
I have two sets of data of different scales. From which I try draw a double bar chart. Because of the problem of differents scales, only one bar can be seen in the figure. One solution can be to normalized the data with large scale, but I wish to plot the bar with their real scales. Can you help me to draw a multi-bar with the same X-axis and two-Y axis such that the scale of the first Y-axis is for the first bar and the scale of the second one corresponds to the second bar. Thanks "Et'o Pat" <patmbom@hotmail.com> wrote in message news:gje1jo$4p4$1@fred.mathworks.co...

y-Axis and x-Axis from different Files
Hi i want to create an gnuplot plot from different files in one. Example: x-Axis from one file force.dat u:2 and y-Axis from way.dat u:2. I find no way to do this. gnuplt makes two lines. have anyone an idea? Thanks Marc Marc Wiemers wrote: > Hi > > i want to create an gnuplot plot from different files in one. Example: > x-Axis from one file force.dat u:2 and y-Axis from way.dat u:2. I find no > way to do this. That's because there isn't one. Data for one curve must be in one file, period. So you'll have to combine your two files into one, at least for the duration of the "plot" command. On sufficient Unix-like platform, a variant of the following should work: plot "< paste force.dat way.dat" using 2:4 ...

two y axis with one x axis
Hi every one please help me in a simple program math marks=1:3; English marks=2:4; students=A,B,C how it is possible to plot marks on y axis with two bars on single x-axis point. for example student A with two bars of Math and English Hi Sohaib, Please see >> doc bar Best. ...

How to set axis equal only to x and y axis?
Dear all As you know, 'axis equal' can make axis equal to x y and z axis. However, I want to apply 'equal' to 'y' and 'z' axis, let 'x' axis be itself. Any comment or advice be my pleasure. Best Regards damayi 2007-12-07 On Dec 7, 12:27 pm, Yumnam Kirani Singh <kirani.si...@gmail.com> wrote: > You have to use it manually on the graphics handle using the set command. Can you give me more about it? I really did not know which property should be set. You have to use it manually on the graphics handle using the set command. ...

Top x-axis and right y-axis
Hello. I have a simple X-Y plot but I was wondering if there is anyway I can add the same x-axis (with the same ticks) on top of the figure. Also, I'd like to add a y-axis on the right edge of the figure. How can I do that? Thanks a lot. Nichola wrote: > Hello. I have a simple X-Y plot but I was wondering if there is > anyway I can add the same x-axis (with the same ticks) on top of the > figure. Also, I'd like to add a y-axis on the right edge of the > figure. doc axes See "Using Multiple X and Y Axes" in the "Axes Properties" chapter for an exampl...

plotting a second y-axis with respect to the first y-axis
I have two data sets, y1 and y2, which are both based on single x-axis. I want to create a second y-axis with a non-uniform scaling so that each point on the second y-axis corresponds to one point in the first y-axis. I do not want to actually plot y2 based on x; rather, I want to change the scaling of y2 so that it corresponds to the points in y1. How can I do that? Thanks, Elnaz On 3/9/2014 3:52 PM, Elnaz wrote: > I have two data sets, y1 and y2, which are both based on single x-axis. > I want to create a second y-axis with a non-uniform scaling so that each > point on the...

Remove right y-axis and top x-axis
I noticed that MATLAB automatically hide or displays the lines/axes on the top side or right hand side of a plot, while I am not using these as axis. How can I manually hide the lines, such that I'm only left with the x- and y-axis? Thanks On 9/29/2012 3:40 AM, monnq wrote: > I noticed that MATLAB automatically hide or displays the lines/axes on the top side or right hand side of a plot, while I am not using these as axis. > > How can I manually hide the lines, such that I'm only left with the x- and y-axis? > Thanks > give an example Normally a plot(x,...

Normalize X axis and set Y axis limit
I have data similar to the following: x = [23.45,24.5,28.2,29.4]; x2 = [39.2,41.5,42.0,44,38.7]; x3 = [199.2,198.4,199.7]; In order to plot this data, I have done something like the following: y = ones(1,length(x)); y2 = 2*(ones(1,length(x2))); y3 = 3*(ones(1,length(x3))); plot(x,y,'.') hold on; plot(x2,y2,'x') plot(x3,y3,'^') What happens when I plot this, is that both the X axis and Y axis scales auto adjust to fit the new data. I would like the X axis to remain the same (stationary), so that the minimum value of x, x2, and x3 all start on the...

Plot with two Y-axis: 2nd axis misaligned
Hi All, I'm using the Student version release 14 SP3. I am ploting a vector (closing prices) of 379,025 entries on the first Y-axis (left) and the relative change in price on the second Y-axis (right). I am using the axes method to manipulate both graphs, as explained in the Matlab examples (http://www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f1-11215.html#f1-11217) While the example above works just fine, the secondary of my particular case is shifted downards. The shift becomes even bigger when I reduce the size of the plot window. I do not have a printscreen to sho...

Surface plot for data with same x axis but different y axes
Hello, I have a somewhat unusual set of data I need to plot. I want to plot this as a surface plot (like surf) as that would really convey the information most concisely. What I have is 9 different datasets for different values of a physical variable A (each with 41 points). Each of the 41 points corresponds to data a certain number of standard deviations away from the mean. The standard deviation for each of the 9 sets is different, and physically corresponds to another quantity B. If I plot using surf, with the x axis being A, and y axis being standard deviation multiples, I do not have a...

Plot 3 sets of data on two y-axis in log scale.
Hello there, I have been trying to put three data sets on left and right y-axis, but couldn't figure out how. Below shows data: x1=[]; y1=[]; x2=[]; y2=[]; x3=[]; y3=[]; What I want to do is to plot (x1,y1) and (x2,y2) on the right y-axis in log scale and (x3,y3) on the left y-axis again in log scale. Could some one please help me on this? Thanks very much. --Hadi On 7/9/2013 12:28 PM, Hadi Mohammadi wrote: > Hello there, > I have been trying to put three data sets on left and right y-axis, but > couldn't figure out how. Below shows data: x1=[]; > y1...

I need to plot dates on the X axis and numeric values on the y axis
I have an Excel spreadsheet with the 1st column being a part number, the next column being a date ie.. 06/30/2004, and the third column being a numeric vale. I need to parse the values for the date and numeric value using the part number, for a graph or chart. How do I convert the date values on the X axis so they will display properly? Ok I think this would be easy could you post a sample file of this> Thanks I used some of the code that was in the vi and modified it to work in my vi. ...

plotting bars and error bars on same axis using different y-axis
Hello, I had a question I wanted to ask regarding plotting different types of displays on the same x-axis only using different y-axis. Specifically, I have two data sets which have exactly the same x-axis, so I want to plot them both on the same subplot. The first data I want to plot using an errorbar display and the second one using a bar display. I want to have two different y-axis for each plot. I tried using the plotyy function, but it doesn't work with errorbars and bars displays. Does anyone have an idea on how to do this? Thank you :) On 2/16/2012 1:25 AM, fdfs tank wrote: &...

How to extract the x-axis and y-axis current ticks of a plot from AbsoluteOptions?
Version 7: Many times I find I need to change the Plot Ticks (mostly to make the ticks display in units of Pi for example instead of just in pure real numbers). The only way I know how to do this now is this: I build my own Ticks lists, and then do Plot[...,Ticks->{myXticks,myYTicks},....] But the problem with this, is tha I have to guess (Actually I do little more than guessing) to obtain a good number of ticks to use, else I get too few ticks or too many. But what would be better is to use the Ticks Mathematica uses on the plot before I change the ticks myself. T...

i need to plot 6 arrays on the y axis and one on the x axis
i need to plot 6 arrays on the y axis and one on the x axis. &nbsp; The XY graph would show 6 lines of data points plotted against one array wich would be my x axis. All arrays are the same size. &nbsp; for example monitoring voltages on 6 devices over temperature. voltages would be the y scale and temperature would be the x scale. &nbsp; i know you can plot multiple wave forms in a waveform graph. &nbsp; When I use the xy graph it only shows one line. i believe it can be done because it the properties menu there's an option to show multiple plots. Thanks &nbsp; PS excu...

Web resources about - How to plot two set of data with same y-axis but different x-axis to the left and right of the y-axis - comp.soft-sys.matlab

We're Liveblogging the GOP Debate From a Ballroom Full of Republicans
Greetings from Conservative Political Action Conference, the nation’s premiere conservative meeting place for politicians hawking books and young ...

Amazon UK Recalls Power Adapters For Fire Tablet
Uh-oh, it seems that over in the UK, Amazon is having some issues with the power adapters for their Kindle Fire tablets and the Fire Kids tablets. ...

The Star Fox: Zero release date is coming in hot
Virtual space enthusiasts have had a busy day. First, we learned that sandbox space sim No Man's Sky will launch on June 21 . Now, we have a ...

Man Shoots Himself Dead While Snapping Selfie
Perhaps all smartphones should now come with a warning that snapping selfies could prove hazardous to your health, or even kill you. Here we ...

North Korea Poo-Pooing Sanctions
A second-grader cannot rule a country (except maybe in Ancient Egypt), yet North Korea’s continuous behavior and apparent disregard for common ...

The Internet Can’t Stop Arguing About the New Ghostbusters Trailer
The ghosts are terrorizing New York again and the new Busters happen to be four of the funniest women in entertainment.

EU president warns migrants: 'Do not come to Europe'
European Union leader Donald Tusk did not mince words on Thursday when he sent a message to economic migrants hoping to settle in Europe. "Do ...

Watch: This Could Be the Most Important Abortion Case in Nearly 25 Years
The Supreme Court heard arguments in Whole Woman's Health v. Hellerstedt, a case that could have the most significant implications for abortions ...

Five years on, closure has yet to come to Fukushima parents
By Kiyoshi Takenaka OKUMA, Japan (Reuters) - Takayuki Ueno did not hesitate one moment to expose himself to high radiation five years ago while ...

AMC Entertainment to buy Carmike in $1.1 billion deal
AMC Entertainment has entered an agreement to acquire Carmike Cinemas, which would create the largest chain of movie theaters in North America. ...

Resources last updated: 3/4/2016 2:35:04 AM