Mon 22 Aug 2016 02:06:26 PM UTC, comment #9:
This looks like a completely different issue. Can you file another report, preferably using gnuplot so that we can see the rotation on-screen.
|
Mon 22 Aug 2016 11:44:46 AM UTC, comment #8:
I haven't applied the proposed patch, but only the work around proposed further below:
h = clabel(c,h, power_scale_labels);
set (h, "rotation", 0)
With this change, everything is in the right orientation.
There is, however, a catch:
When I change the range of the x-scale from
wind_speed = 7:0.1:13; to wind_speed = 7:0.1:14;
then one of the c-labels is completely out of position. See attachment wrong_clabel_position.png
Is this problem related to the original topic or different from it?
(file #38313)
|
Mon 22 Aug 2016 02:55:53 AM UTC, comment #7:
I pushed your cset here (http://hg.savannah.gnu.org/hgweb/octave/rev/788f554ac87d). I played with the "verticalalignment" field and was able to prove that the problem is that we aren't getting a very good idea of the height of the text. The labels look good enough though so I'm closing the report.
|
Sun 21 Aug 2016 07:27:40 PM UTC, comment #6:
@Rik: I attached 2 png files I captured in Evince when viewing your pdf file (5000.png and 20000.png).
I can see both labels are "below" what we obtain using gnuplot (see 5000_gnuplot.png and 20000_gnuplot.png). Now I still can't see that 20000 is worse than 5000.
In any event, using any other font than Helvetica, Times-Roman, or Courier (and Zapfdingbats if you feel adventurous) leads to the same fallback font: Helvetica.
(file #38304, file #38305, file #38306, file #38307)
|
Sun 21 Aug 2016 02:48:14 PM UTC, comment #5:
@Pantxo: I would go ahead and apply the patch, and then we can figure out why I'm seing label offsets. It may be due to font choices. I have Verdana selected as the UI font, which maybe doesn't have a PostScript implementation.
Attached is the pdf I get from running the tst_clabel.m script. Look at the 20000 label.
(file #38299)
|
Sat 20 Aug 2016 10:11:56 AM UTC, comment #4:
@Rik: using opengl toolkits, I can see no difference in the printout between "5000" and "20000" labels. The labels are both slightly below the contour line but I think this is another bug that can be reproduced e.g. by the following example:
As you can see the legend text is slightly below its on-screen position. This is probably due to the tricks we use to handle the (unfortunate) equivalence between pixels on screen and points in gl2ps printout.
|
Fri 19 Aug 2016 04:06:42 PM UTC, comment #3:
@Pantxo: I generally like the patch. Before it gets pushed, however, could you take a look at the positioning of labels? What I see is that the labels are no longer exactly on the contour line. The problem seems to grow worse if the label is long. I've uploaded a script (tst_clabel.m) which demonstrates this. Look at the label for "20000" in the upper right corner and you will see that it is barely on a contour line.
(file #38283)
|
Thu 18 Aug 2016 10:07:53 PM UTC, comment #2:
I attached a very simple patch.
(file #38261)
|
Thu 18 Aug 2016 07:45:39 PM UTC, comment #1:
There are two issues here:
- On screen when using opengl based toolkits the labels are displayed with a rotation = 0° because the actual "rotation" property of text objects is (a bit) lower than 90°.
This is a known bug of the opengl text renderer, see #33118. The only workaround is to use gnuplot toolkit.
- The computed rotation seams wrong: the orientation of the labels should be parallel to the contour lines. See e.g. "demo clabel 1".
If you're happy with horizontal labels then a workaround is to set the rotation manually
So finally it is the printed output that is correct :-). Retitling the report to reflect the second issue.
|
Thu 18 Aug 2016 03:22:44 PM UTC, original submission:
When I run the following code I get the wanted plots on the screen. All labels for the "iso"-lines are upright. However, when I print the figure (png, epsc2, pdf) the labels are 90 degrees rotated (parallel to the y-axis)
wind_speed = 7:0.1:13;
rotor_diameter = (100:5:250)';
rho_wind = 1.225;
c_p = 0.45;
eta_mech2el = 0.94;
power_scale_lines = 5:1:20;
power_scale_labels = 5:5:20;
options = ['c_p = ', num2str(c_p), ', \eta_mech2el =', num2str(eta_mech2el)]
power_wind = c_p * eta_mech2el * 1/2 * rho_wind * pi * (rotor_diameter/2).^2 * wind_speed.^3;
figure
[c, h] = contour(wind_speed, rotor_diameter, power_wind/1000/1000,power_scale_lines);
grid on
clabel(c,h, power_scale_labels)
xlabel('wind speed [m/s]')
ylabel('rotor diameter [m]')
title(options)
print -dpdf scaling_rules_1.pdf
print -dpng scaling_rules_1.png
print -depsc2 scaling_rules_1.eps
|