How to Create a 2-D Contour Plot with Labels Using Gnuplot?

Click For Summary

Discussion Overview

The discussion centers around creating a 2-D contour plot with labels using Gnuplot, specifically from a data file containing three columns representing X, Y, and magnitude values. Participants explore methods for generating contour plots and addressing issues related to data formatting.

Discussion Character

  • Technical explanation
  • Homework-related

Main Points Raised

  • Hamid seeks guidance on generating a 2-D contour plot from a data file with specific column arrangements for X, Y, and magnitude.
  • One participant suggests basic commands for generating a contour plot, noting that Gnuplot can create a key mapping for contour values but requires additional methods for numerical labels on the contours.
  • Hamid clarifies that his data does not have a grid format and asks how to create a grid for the X and Y axes.
  • Another participant indicates that the data might already be in grid form depending on its organization and suggests using Gnuplot's help commands to explore grid data options and the dgrid3d function for scattered data.

Areas of Agreement / Disagreement

Participants have not reached a consensus on the best approach to create the contour plot, and multiple views regarding data formatting and plotting methods remain present.

Contextual Notes

There are limitations regarding the assumptions about data organization and the potential need for additional steps to convert non-grid data into a suitable format for contour plotting.

hamidamini
Messages
2
Reaction score
0
Hello
with gnuplot
I need to have 2d contour plot from a file (say ss.dat) with three column, first and secend columns are X and Y respectively and the third column is magnitude (I need to have this magnitude with labels on it in 2d plot).

Thanks in advance
Hamid
 
Physics news on Phys.org
Assuming your file contains grid data, the basic commands to generate a contour plot would be

set contour base
unset sur
set view map
splot 'file'

gnuplot will generate a key mapping dash patterns in the contours to values. If you want actual numerical labels printed on the contours, you have to resort to tricks. I describe one way to do it in the gnuplot Cookbook.
 
Thank you very much. my file dose not have grid data. it just has three coulmn first is "x"axis second "y" and third is just the data I want to have the plot of. How can I grid x and y axis.

Thanks
 
Your data might already be in grid form, depending on how it is organized. Type "help grid_data" at the gnuplot interactive prompt to find out what this means. Even if it is not, the plot might work. Try it and see. If your data is scattered you might be able to plot it after letting gnuplot convert it into a grid arrangement. Type "help dgrid3d" to find out how to do this.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
8K