PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, June 27, 2022

[FIXED] How to label zrange in multiplot graph in gnuplot?

 June 27, 2022     gnuplot, graph     No comments   

Issue

I am plotting multiplot surfaces. I found this code 1 very helpful to plot my graph. However, I want to label the z-axis throughout all surfaces in one plot. I tried this set zrange[0.5:b+0.5], but nothing showed up. then I tried min_z and max_z, still, nothing showed up. though I calculated and checked the range by the following the command.

print min_z,max_z.

can anyone please tell me how can I choose zrange with my own choice? like 1 ,2 3 4 5.


Solution

I will expand my comment as a possible answer. Multiplot is not needed for this style of plot. Here is an approximate recreation of the figure you linked to.

If you want to customize the axis labels along z, you can add a command to change the format like this: set ztic format "%.2f", and/or add additional commands of the form: set ztic add ( pi/2 "z = π/2" )

f(x,y,z) =  besj0(x*x/z + y*y/z) / z

set palette cubehelix

set xyplane 0
set view 64,58
set ztics 0.2
unset key

splot for [i=1:6] z=(1.+i/6.), '++' using 1:2:(z):(f(x,y,z)) with pm3d

enter image description here

Answer expanded to show plotting from a series of files

Plotting from a series of files is essentially the same. The splot command again inserts a constant z value to create a plane, taking the data coordinates [x,y] from columns 1 and 3 and the f(x,y) value from column 4.

Here is an example:

set palette defined( 0 "dark-red", 1 "yellow" )

set xyplane 0
set view 74, 62, 0.85, 1.8
set border 16      # z axis only
unset xtics; unset ytics
unset key


file(i) = sprintf("map%d.dat",i)
set ztics ("File 1" 1, "File 2" 2, "File 3" 3, "File 4" 4)

splot for [i=1:4] file(i) using 1:2:(i):3 with image

enter image description here



Answered By - Ethan
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing