I created a patch to make the smooth unwrap filter respect the set angles setting. With the patch, whenever set angles is set to degrees, the function looks for differences bigger than 180 (instead of pi) and adds or subtracts 360 (instead of 2*pi.
I do not have a build environment to test this but it is straightforward and should work. All I did was to include gadgets.h in interpol.c and then divide all the M_PI values in the unwrap function by ang2rad.
I would really appreciate it if anyone can test this and include it in the next version of gnuplot if we all agree that smooth unwrap should respect the set angles flag.
I will look at the patch, but note that it is trivial to convert from degrees to radians on input already:
Understood, but in my use case, I use
set angles degreesnot because my data are in degrees, but because I am plotting a function and I want the final plot to be in degrees. In that case, we need to convert from radians to degrees, which messes up smooth unwrap. For example,generates the plot I want in radians. How do I generate the same plot in degrees?
I tried
That does not work since it adds and subtracts
2*pifrom the points instead of360.Is there a way to scale the plot after smoothing rather than before?
Last edit: Rushi 2022-07-12
You can
to have radians on the left and degrees on the right, or plot on the (not viewed) y2axis and set up the link the other way round
That works for plotting, but when I
set table, the table that gets output contains only the radian values, not the degree values. I tried bothand
as per your suggestions. Is there a way to make
gnuplotoutput they2values to the table instead of theyvalues?Context:
I wrote a LaTeX package named
bodeplotthat usesgnuplotwithpgfto generate all the plots. Inpgf,gnuplotis used to output a table, which is used with nativepgfplotting tools to generate the plots. I could rescale axes inpgfsimilar to your suggestion, but it would be better if the datagnuplotgenerates were themselves in degrees whenset angles degreesis enabled. This is already the case if I were just plotting a function, but theunwrapfilter does not abide by theset angles degreesflag, hence the patch!Last edit: Rushi 2022-07-13