gnuplot: plotting contour without labels works, with labels no - label

i am trying to plot a contour from a gridded data file called 'sample'. This script works fine for me:
set xrange[1:1e2]; set yrange[1:1e2]; set log;
set view map; unset surface
set style textbox opaque margins 0.5, 0.5 noborder
set contour base
set cntrlabel format '%5.3g' font ',7'
set cntrparam levels discrete 1e40,1e42,1e44
splot 'sample' u ($1*1e27):($2*1e18):3 wl
it plots a 2D plot with contour lines. All fine.
If i only dare to continue the plotting line with
'' u ($1*1e27):($2*1e18):3 with labels boxed notitle
to add labels to the contour lines, it takes around 15 minutes to produce a blank plot. Using gnuplot examples on sourceforge, it works.
Have you ever experienced something similar?
Many thanks in advance

Related

Plot contour plot with label but witout dots

I have to plot contour plots in gnuplot with labels but without dots. I tried several steps to avoid dots in my plot. I want my plot with contour values in plot. For that I used splot with labels. But gnuplot plots dots in plot. how this can be avoided.
splot 'DM_Plot.txt' using 1:($2/1000):3,'DM_Plot.txt' using 1:($2/1000):3 with labels
I think we need to see more of the command sequence. It is not obvious that the dots visible in your figure come from the "splot" command. "set grid dashtype '.'" could produce such a thing. Do you have a "set grid" command?
I would guess that the sequence of commands you need is something like
unset grid
set pm3d explicit
set contours
splot 'DM_Plot.txt' using 1:($2/1000):3 with pm3d, \
'DM_Plot.txt' using 1:($2/1000):3 with labels
Does that match what you tried?

Rotating a heat map from a matrix in gnuplot

I'm trying to rotate 45ยบ a heat map coming from a matrix. The problem when rotating the discrete data is that the plot exceeds the window's size, reaching labels and tics place. Any idea or alternative to solve the problem?
Main code
set xrange[-20:20]
set yrange[30:50]
plot "test.txt" u ($2-$1+1):($2+$1):3 matrix with image notitle
And what I
obtain. The data file http://www.filedropper.com/test_146
I would suggest an alternative using splot with pm3d because the set pm3d has the option clip1in and clip4in which tells gnulpot which qudrangles to plot, but is available:
set pm3d map clip4in corners2col c1
set yrange[10:*]
splot 'test.txt' u ($2-$1+1):($2+$1):3 matrix with pm3d notitle
It will show some spurious triangles:
If you want to go for an interpolation, have a look at this question
Pay attention that splot [...] with pm3d will draw the colors of the quadrangles, so that if your matrix s NxM, you'll get (N-1)x(M-1). On the other hand using plot [...] with image you'll get NxM quandrangles. (see help image).

How to bold legend and axis in 3d scatter plot in Matlab

I have one question. How to bold legend and axis in 3d scatter plot in Matlab?
Anyone can help me.
Thank you
Run this after the figure is created, it sets all text elements of the current figure to bold:
set(findall(gcf,'type','text'), 'FontWeight','bold')
It is not 3D scatter specific and is answered here as well: Changing Fonts in Matlab Plots

D3.js contour plot not working (Possible bug of d3 contour)

I am plotting a d3.js contour plot. I am following the same steps as shown in the link http://bl.ocks.org/mbostock/4241134 and https://gist.github.com/mbostock/4241134. But the problem is my code is not working. The size of my 2D matrix for contour plot is dx=82 and dy=141. My code is not plotting anything instead its hanging the browser. I wonder is there any size restriction of matrix on the contour plot? Do you have any idea?
Actually its not really a bug, it's just that the data is incompatible with the colour domain you have specified. For example, the colour domain runs from 95 to 195 and your data is all 10. So there is no intersection between the data and the contours. This is the failure mode.
If you change your contour domain or your data so that they intersect it will be fine.

Shifting Output Image Down Gnuplot

I am typing this in textedit and load it into gnuplot later. When I do so the image is slightly off the top of the screen which means I can't see some of it. Is there a way to shift the entirety of the imaged produced down, or start the z-axis lower on the image?
Also, how do I make either my points or my lines black? Currently the lines for my sphere are red and the points are blue.
set pointsize 2
set tics
set border
unset key
set size ratio -1
set size square
unset xzeroaxis
unset yzeroaxis
unset zzeroaxis
# linetype linewidth
set xrange[-1.2:1.2]
set yrange[-1.2:1.2]
set zrange[-1.2:1.2]
set view equal xyz
set xyplane at -1.2
set parametric
set isosamples 20
set hidden3d
set urange [0:2.0*pi]
set vrange [-pi/2:pi/2]
r=1.0;
# Parametric functions for the sphere
fx(v,u) = r*cos(v)*cos(u)
fy(v,u) = r*cos(v)*sin(u)
fz(v) = r*sin(v)
splot fx(v,u),fy(v,u),fz(v),"mypoints" u 1:2:3 w p 3
Thanks, A.
I shall try the transformation thing, but to try to explain my issue further just have a look at these pictures.
The first is what I get out when I run the code (now I have made everything black). The second is the same picture, but rotated (just by click, holding and moving the mouse around). As you can see on rotation the picture is off the screen. I just want the picture to be in the centre of the screen, I can't think why it wouldn't be.
Also why is there 1 or 1.5 of the z axis below the image? I don't really want that there either. Is there a way to set scales on x,y, and z axes equal? the set square thing has done it for x and y but as you can see the sphere is squished as well.
Thanks, A.
http://tinypic.com/view.php?pic=k59gx&s=6
http://tinypic.com/view.php?pic=2v9eo93&s=6
Note: I couldn't upload an image due to lack of rep, but I thought it would be the best way to illustrate my issue. The links show the images I am talking about.
Running your script, omitting the reference to "mypoints", I get the plot you want without any extra z-axis or the top getting cut off. I'm using gnuplot v.4.4.3. What version are you using? Have you tried it without also plotting "mypoints"? There might be something in there affecting the plot. Also, you might want to explore coordinate mapping (try "help mapping" at the prompt) to plot datafiles in spherical coordinates.
Ok, so basically there are loads of issues that need solving so here goes:
1) Don't shift the picture down, get rid of the little tag end from the z part of the border. This makes the picture more central.
To do this: set ticslevel 0.0
2) Aspect ratio is not maintained in X11 so it looks all squashed. This is spoken about here:
http://sourceforge.net/tracker/index.php?func=detail&aid=3331162&group_id=2055&atid=102055
The workaround as they say is to set the size of window that X11 outputs to to be square, to do this: set terminal x11 size 800,800
3) Note, you don't now need: set xyplane at -1.2 (or what ever z value you want) as this is taken care of using the set ticslevel command.
So now I have this:
set pointsize 2
set tics nomirror
set ticslevel 0.0
set border
set view equal xyz
unset key
unset xzeroaxis
unset yzeroaxis
unset zzeroaxis
# linetype linewidth
set xrange[-1.2:1.2]
set yrange[-1.2:1.2]
set zrange[-1.2:1.2]
set parametric
set isosamples 20
unset hidden3d
set urange [0:2.0*pi]
set vrange [-pi/2:pi/2]
r=1.0;
# Parametric functions for the sphere
fx(v,u) = r*cos(v)*cos(u)
fy(v,u) = r*cos(v)*sin(u)
fz(v) = r*sin(v)
splot fx(v,u) w lines lc rgb "black",fy(v,u) w lines lc rgb "black",fz(v) w lines lc rgb "black","mypoints" u 1:2:3 w points lc rgb "red" p 2
Hope this helps people in future.

Resources