There are different ways to interpolate the data, for which you can check help set dgrid3d for more info. The set dgrid3d option helps you create a regular grid and interpolate the values from your scattered data set. Plot $Contourg3_ord u ($1 0.15):($2 0.You need some smoothing (or interpolation algorithm). # add the two curves but reverse the second of themĭo for \ # do the same thing with the shifted $Contourg Plot $Contourg u 1:2 skip 5 index 0 every :::i::i with table N = STATS_blank-1 # number of empty lines Stats $Contourg skip 6 nooutput # skip 6 lines # determine how many pieces $Contourg has I admit, this is not a "clean" and "robust" solution, but it somehow works. But I guess there might be also some other weird workarounds. This procedure will work OK for strictly monotonous curves, but I guess you will get problems with oscillating or closed curves. Then combine the two datablocks by printing them line by line to a new datablock $ClosedCurveHatchArea, where you actually reverse one of them. Do the same thing for the shifted contour line into $ContourgShiftedOnePiece. Determine the number of these "blocks" by stats $Contourg and STATS_blank. To get the order right, plot the data into a new datablock $ContourgOnePiece starting from the last block ( every :::N::N)to the first block ( every :::0::0). I don't know why but that's the contour lines gnuplot creates. For whatever reason, the contour line data consist out of several blocks separated by an empty line and it's not a continous sequence in x. But you have to reverse one of the curves (similar to what I already described earlier: ). The basic idea is simple: take the original curve and the shifted one and combine these two curves and plot them as filled. It's just a matter how complicated or ugly you allow it to become.įor such steep functions use the following "trick". With gnuplot you will probably find a workaround most of the times. Replot $Contourg2 u 1:2:($2 0.5) skip 5 index 0 w filledcurves lc 0 notitle Replot $Contourg1 u 1:2:($2 0.2) skip 5 index 0 w filledcurves lc 0 notitle Replot $Contourg2 u 1:2 skip 5 index 0 w l lw 4 lc 0 title columnheader(5) Replot $Contourg1 u 1:2 skip 5 index 0 w l lw 4 lc 0 title columnheader(5) Plot for $Contourf u 1:2:(i) skip 5 index i-1 w l lw 1.5 lc var title columnheader(5) You need to play with the shift value and the hatched fill pattern.Ĭode: # contour lines with hatched side Unfortunately, there is also only a very limited number of hatch patterns in gnuplot (see Hatch patterns in gnuplot) and they are not customizable. However, this works only well if the curve is a straight line or not too much bent. One workaround could be the following: shift your curves slightly by some value and fill it with filledcurves and a hatch pattern. I'm not aware of a feature in gnuplot which would generate such hatched lines. $Contourg2d u 1:2:(1) skip 5 index 0 w l linetype 101 notitleĪmended to show use of contours offset so that the dashes are only on one side of the line. $Contourg1d u 1:2:(1) skip 5 index 0 w l linetype 101 notitle, \ $Contourg2 u 1:2:(1) skip 5 index 0 w l lw 1 lc "black" title columnheader(5), \ $Contourg1 u 1:2:(1) skip 5 index 0 w l lw 1 lc "black" title columnheader(5), \ Plot for $Contourf u 1:2:(i) skip 5 index i-1 w l lw 1.5 lc var title columnheader(5), \ Set linetype 101 lc "black" linewidth 5 dashtype (0.5,5) # Additional contour levels displaced by 0.2 from the original Another possibility is to use a custom dash pattern, as shown below:īy the way, it is almost never correct to use "replot" to compose a single figure.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |