This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Plotting 4 curves in a single plot, with 3 y-axes
Dear stackoverflowers,
I need to plot 3 curves with same X axis (time) but three different dimensions (Volt, temp, current). The best outlook, to me, would be to have two Y axis on the left side, separated by a few pixel so we can read legend and ticks for each.
The answer to my questions are not plotyy neither multiple X or Y axis . In the first case, it helps me plot two different dimensions, not three.
the latter helps me associate right or left Y axis to a particular curve. I used the YAxisLocation option for my third curve but if I put it right or left, of course it interfers with the other YAxis that was there before. There is no option like left - 20 pixels ?
Thank you for your help.
You could just use plot (which will take care of the scale) and then include a legend to say what your units are (e.g. volts, degrees, etc)
Related
I have 3 lines on a plot, each with massively different unit scales. I would like to plot 1 yaxis left and 2 yaxis on the right side, currently I just reduced the one line's value by a factor. Also in the future I would like to have 2 axis on one side to maybe display SI units and empirical for a single line. Currently im using yyaxis left and yyaxis right for the left and right yaxis
Can matlab add 2 axis on one side?
How to do it?
Edit: If not, what shenanigans can achieve the same result?
This question already has an answer here:
Area between line and curve (no function)
(1 answer)
Closed 6 years ago.
I want to determine the area between the red line and the blue line but only to the y-value of 4.559. How can I achieve that?
In general:
First you have to subtract the two functions from each other. After
that, you have a function that represents the delta in y for each
point on the x-axis.
After that you have to calculate the integral, for matlab you should look here Matlab - Numerical Integral
The last step is inserting the left, and the right bound of your desired area to calculate. The result is the area under the surface
Be careful when subtracting the functions, the result of the area might be negative (negate it in this case) if the "bigger" function is the subtrahend
This question already has answers here:
MATLAB - How to zoom subplots together?
(3 answers)
Closed 7 years ago.
I created a figure with 8 subplots of timeseries objects, because I wanted to have an overview of the data.
Is there an option which gives me the following possibility:
If I zoom into one subplot (for example: just the range from 5 to 10 on the x-axis is now visible), than all other plots will automatically zoom in (such that the range from 5 to 10 on the x-axis is now just visible for all other subplots) too??
For linking both the x and y axes, you should use the command linkaxes. It takes as input a vector of handles to axis objects you want to link together, and additional options if desired.
Example:
for k = 1:4
ah(k) = subplot(2,2,k);
plot(1:10, rand(1,10));
end
linkaxes(ah);
After this, if you apply e.g. zooming on any of the subfigures, the x and y limits of the other axes will change as well.
If you want to link only, say, the x axis, use instead:
linkaxes(ah,'x');
This question already has answers here:
What is the default MATLAB Color Order?
(2 answers)
Closed 7 years ago.
This may seem like an overly simple question. What is the default colour of the x, y and z axis in Matlab? I have searched the internet and can't seem to find an answer. Bellow is a sample graph. As I know the data, I think the blue line represents z axis, red represents y axis and yellow represents the x axis. However, I am not sure and would like someone to confirm this,
Thanks.
Matlab will colour plots consecutively from the same palette in the order in which you call the ´plot´ commands, so in all your examples the blue line is the first one you plotted and so on. The colororder is static but can be changed. See this page for the order and how to change it.
As far as 'x, y and z' goes are you referring to the meanings you have ascribed to the data? Because matlab doesn't infer anything like that - if your variables are called x or y or whatever it will ignore that and plot them in the order you called the plot commands.
I have this X axis in my sample project on Core Plot and I wonder how I can customise it a little bit. As you can see it currently has only 3 values on the X axis:
But the values of the two plots I have (the black and grey ones) go far beyond the number of points in the X axis (29 against 3 points). Because of the fact that I have 3 points, only 3 values for each plot are shown.
I would like to keep displaying the remaining 3 points on the axis but accommodate all my 29 events for my plots (they could be displayed in the middle of 1 and 2 point).
How can I do this?
Increase the length of the xRange of the plot space. The value needed depends on the plot data.