I have a problem plotting heatmap with log colorbar with Gnuplot.jl. I currently use the following code
using Gnuplot
#gp P_save "w image notit" "set logscale cb"
which generates the following figure
The problem is I need to replace y axis with its real value (using another vector called Depth) rather than using index from 0 to 150. And Depth has Non-uniform grid.
And do the same for x axis too.
I have looked at these two posts enter link description here and enter link description here. But in my case I don't have external files and data are in variable arrays or vectors.
P_save is 150×731 Matrix{Float64}, Depth is a 150-element Vector.
I am very new to both Gnuplot.jl and gnuplot.
Thank you so much!
Related
I would like to know how to set the axis range and achieve the same behavior that Google Image Charts had. Here is the example for the same request URL:
I.e., I have an y value on each 100th of x axis. Is there a way to easily define a dataset 'step' for Image Charts, or I have to create custom labels on x axis with chxl, which I would like to avoid?
Image-Charts founder here :)
Indeed, regarding axis range our documentation is (I hope) explicit:
In Google Image Charts specifying the chxr parameter changed the scale of the axis but not the dataset scale. In Image-Charts — because we think it's was the biggest usage issue with Google Image Charts — changing the axis scale through chxr also impact the whole dataset scale.
You must make an axis visible using the chxt parameter if you want to specify its range.
You will have to use axis range (chxr) to better specify what you want and the steps needed:
chxr=
<axis_index>,<start_val>,<end_val>,<opt_step>
|...|
<axis_index>,<start_val>,<end_val>,<opt_step>
I have drawn a plot using "plotArrays" function in Dymola. I would like to label X-axis in meters(Ideally, I need it to be flexible so that I can later change it to millimeters, micrometers, etc..). I want to label Y-axis similarly in volts which I have done already using
plotArrays(x_axis,phie,legend=names,units=fill("V",size(phie,2)));
and I can read the values in volts and also change to mV etc.. However, its not 'visible' in Y-axis as you can see in the plot below. So, How can I label the axes separately?
Thanks a lot!
I don't know any more efficient possibility than this:
createPlot(id=1, erase=false, grid=true, leftTitleType=2, leftTitle="myLabelY", bottomTitleType=2, bottomTitle="myLabelX")
with:
id being the number shown in the original plot
erase=false to ensure that the content is not modified
grid=true (re-)enabling the grid
*TitleType=2 saying that there is a custom title
*Title being the string to put there
This will result in the plot being resized to the default size. You can use plotSetup() to get the current setup, including position, which you can then pass (manually) to the createPlot() command to result in the original size again.
Not very elegant, but I don't know any other possibility...
Using Julia-lang, how can a scatterplot of two vectors be plotted with pyplots (or GR) to label each point with a specific string? Eg. each paired (x,y) takes on the index value they both share? Example from MATLAB: image example
Do you mean with GR or PyPlot themselves, or through Plots.jl? I know Plots.jl best - with that you'd do scatter(x,y, series_annotations = text.(1:length(x), :bottom)) .
Unfortunately it currently plots very close to the points - :bottom means that the bottom of the text touches the point.
I am using Google Chart Image to make graphical chart. I am using PHP to provide the data to the link which in return gives me desired chart. The x-axis and y-axis values are also dynamic i.e. if the graph data is 23,45,37,29... then the y-axis value will range from 20 to 50 and if it is more then that then it will scale according to the data..
Now the problem I am not able to solve is that the dynamic values work fine but I am not able to move the graph line. The image below will clear this point:
Click here for the graph image.
The data provided to this graph is = 190.12,185.53,186.22,186.71,185.87,185.57,186.50,186.58,190.71,191.41,190.12185
The data range is approx between 180 to 190 but graph drawn is between 198 and 200.
I have used chxr to scale the axis. and the link which I am dynamically updating through php is:
THIS
I believe the problem you've got is that you're scaling the axis labels, but not the axis itself. You want to change the chds parameter from a to the range you're dealing with.
This chart looks okay to me.
I have a 2D CFD code that gives me the x and y flow velocity at every point on a grid. I am currently visualizing the data using a vector field in gnuplot. My goal is to see how far the plume from an eruption extends, so it would be much cleaner if I could prevent vectors from showing up at all in the field if they fall below a certain magnitude. Does anyone have an idea how to go about this? My current gnuplot script is below. I can also modify the input file as necessary.
reset
set nokey
set term png
set xrange [0:5.1]
set yrange [0:10.1]
do for [i=0:10] {
set title 'Eruption simulation: Timestep '.i
set output 'path/FlowVel'.sprintf('%04.0f',i).'.png'
plot 'path/Flow'.sprintf('%04.0f',i).'.dat' using 1:2:3:4 with vec
}
I guess you want a kind of filtering, which gnuplot doesn't really have, but can be achieved with the following trick (taken from "help using examples" in gnuplot):
One trick is to use the ternary `?:` operator to filter data:
plot 'file' using 1:($3>10 ? $2 : 1/0)
which plots the datum in column two against that in column one provided
the datum in column three exceeds ten. `1/0` is undefined; `gnuplot`
quietly ignores undefined points, so unsuitable points are suppressed.
Or you can use the pre-defined variable NaN to achieve the same result.
So I guess you would want something like this in your case
plot "data.dat" u 1:2:($3**2+$4**2>mag_sq?$3:NaN):($3**2+$4**2>mag_sq?$4:NaN) w vector
where mag_sq is the square of your desired magnitude.