I am quite new to gnuplot. And I've got problem with secondary y axis. When I try to plot two curves into one graph with two different y axis, the second one is moved down a little bit. I mean that if you draw a straight line parallel to the x axis at y1 = 0, you get different y2 values. I want both y axes to start at the same point y1=0 ~ y2=0.
Here is the picture better describing my problem:
Related
I have been using pandas, matplotlib and seaborn for data visualisation but I can't figure out how to permanently change the axes limits? I will show you what I mean below:
I want the y axis to go from 0 to 300 and the x axis from -4 to 4 (so that the background grid is complete, none of the squares are cut off).
In general I want the following:
Let the step on the y_axis be z (so 50 in the case above). Then, matplotlib automatically stops the y axis at y_max (maximum y value from the data).
This y_max lands in between kz and (k+1)z, for some positive integer k (in the case above, it lands between 250 and 300, so 5*50 and 6*50, so k=5). Now, I want the y axis to stop at (k+1)z and not y_max.
And similarly for the x-axis.
I know that I can set the y limits and x limits manually for each plot, but is there a way I can somehow permanently get matplotlib/pandas/seaborn to automatically create the figures in such a way?
I tried looking at the rcParams on matplotlib but couldn't really see anything of use.
Ok, so I have two data series graphed, like so.
These are two scatter plots, based on x and y values, that are produced using a combo chart. The orange scatter plot is an ellipse whose calculation is based upon aspects relating to the purple scatter plot. I have made the orange ellipse in order to... well... select the part of the purple scatter plot that I want to do other things with. Problem is, I don't know how to actually select the data points this area refers to.
The data for this chart is based upon four columns: A,B (forming the purple plot) and C,D (forming the orange plot). Reordering the columns makes little difference.
Implementing Anger's proposed solution below, all instances seem to return true. Also, there happen to be more scatter plot rows than there are ellipse rows, so I'm not sure how to solve that for the sake of comparison.
If you specify the equation of the ellipse (center point and semi-major/minor axes), you can use the equation of the ellipse to flag points that are inside or outside.
if( ((Ex-x)/Lx)^2+((Ey-y)/Ly)^2 < 1, "INSIDE", "OUTSIDE")
Where Ex, Ey are the coordinates of the ellipse's center; x, y are your data point's coordinates, and Lx, Ly are the semi-major and semi-minor axes.
Just by eye, I would say Ex = 1.8, Ey = 1.21, Lx = 0.6, and Ly = 0.5.
I have a bunch of data that I'm plotting as point plots. The data is simply a column for X and a column for Y. The catch here though is this is plotted using axes x2y2.
The x1y1 is used for a histogram. The X axis is the same range for both plots.
I know how to derive the X coordinate, but am wondering if there is an easy way to determine the Y value to use to draw an arrow. I want to draw an arrow callout for an arbitrary point on the point plot.
y1 and y2 are independent.
The coordinates for drawing the arrow can refer to different coordinate systems (first, second, character, screen, and graph, see help coordinates).
So, to draw an arrow e.g. from the top-middle of the plot (graph 0.5, graph 1) to x2 = 1, y2 = 2 (second 1, second 2) you would write
set arrow from graph 0.5, graph 1 to second 1, second 2 head
i've got a data set that is of a vector f(x,y,z). Formatted as fx fy fz x y. This data set is of a crystal lattice and it's associated reciprocal lattice. The coordinates x y are in a non orthogonal basis. Such that x and y are unit vectors x=(1,0) y=(0.5,sqrt(3)/2). I'm trying to plot a set of 3 heatmaps one for each component of f. My issue is that I can seem to change the x and y axis such that they are the unit vectors above. Is there a way to make non-orthogonal/perpendicular axes in gnuplot? If not does anyone have any ideas on how to represent this data set?
Thanks in advance
What you can do is not change the axes, but apply a change of variable from your columns 4 and 5 to the cartesian coordinates x,y:
ex_x=1; ex_y=0
ey_x=0.5; ey_y=sqrt(3)/2
splot "file.dat" u (ex_x*$4+ey_x*$5):(ey_y*$4,ey_y*$5):1 with pm3d
1-How can I rotate my plot so y would be the new x axis and vice versa?
2- Change the maximum value of y axis from 60 to 100.
The plot is created by this script in the terminal :
set palette grey
plot 'color_map.dat' matrix with image
You can exchange the x and y axes with the using modifier. (Just like for ordinary plots, except that for matrix data, columns 1 and 2 are not in your data file, but are inferred.)
plot 'color_map.dat' matrix using 2:1:3 with image
If you actually just want to change the maximum value on the y (new x) axis, you would use set xrange[:100]. But it sounds like you might actually want to scale the data itself, in which case you could use
plot 'color_map.dat' matrix using ($2/60.*100):1:3 with image
Try help plot matrix for more details.