Issues and suggestions

129 views
Skip to first unread message

legro jan

unread,
May 13, 2013, 10:57:09 AM5/13/13
to mat...@googlegroups.com
Hello Alexey (and everyone else),

MathGL has now become an important part of my C++ toolkit. I have been testing the latest (2.1.3) version of the library, and I would like to share a few issues that I have encountered, as well as some suggestions that I have to improve it even further.

  • For some values of Rotate, the tick labels appear inside the box instead of outside (see attached figure). This is rather undesirable since it can lead to the graph overlapping the labels, as shown.
  • A similar issue occurs with the colorbar labels. If they get rotated, they overlap with the colorbar itself. This can be seen in the colorbar examples from the manual.
  • I have tried to set transparencies to 1D graphs, but didn't manage. It would be quite convenient to have, for instance, several Area graphs with transparencies so that one can see them all even when they overlap.
  • The Cones plot is widely used in finance, however I have always seen it with bars instead of cones. An option, perhaps? Bars() does not seem to behave the same way...
  • I like the Box() function a lot, however when plotting a complicated graph with lots of lines, the axes and ticks get a little in the way, in my opinion. I would suggest to create a HalfBox() function that draws only the box sides that are behind the graph itself. This is very common in many graphing tools, like Matlab (see second attached picture).

So, here's my little grain of sand to try and help out in this amazing tool that MathGL is. I hope some of it proves useful.


Best regards,


Jan

overlap.jpg
plot19.jpg

mathgl....@gmail.com

unread,
May 13, 2013, 3:12:54 PM5/13/13
to mat...@googlegroups.com
Dear Jan


2013/5/13 legro jan <legr...@gmail.com>

Hello Alexey (and everyone else),

MathGL has now become an important part of my C++ toolkit. I have been testing the latest (2.1.3) version of the library, and I would like to share a few issues that I have encountered, as well as some suggestions that I have to improve it even further.

  • For some values of Rotate, the tick labels appear inside the box instead of outside (see attached figure). This is rather undesirable since it can lead to the graph overlapping the labels, as shown.
  • A similar issue occurs with the colorbar labels. If they get rotated, they overlap with the colorbar itself. This can be seen in the colorbar examples from the manual.
Hmm. These 2 points look as a bug. Can you send me the angles?
 
  • I have tried to set transparencies to 1D graphs, but didn't manage. It would be quite convenient to have, for instance, several Area graphs with transparencies so that one can see them all even when they overlap.
OK. I'll add transparency for the Area, Bars, and similar 1D functions.
 
  • The Cones plot is widely used in finance, however I have always seen it with bars instead of cones. An option, perhaps? Bars() does not seem to behave the same way...
 
  • I like the Box() function a lot, however when plotting a complicated graph with lots of lines, the axes and ticks get a little in the way, in my opinion. I would suggest to create a HalfBox() function that draws only the box sides that are behind the graph itself. This is very common in many graphing tools, like Matlab (see second attached picture).
Grid() function do exactly this.
 

So, here's my little grain of sand to try and help out in this amazing tool that MathGL is. I hope some of it proves useful.

Thank you.

--
All the best,
Alexey Balakin

legro jan

unread,
May 14, 2013, 3:58:30 AM5/14/13
to mat...@googlegroups.com
Hi again,
 
Hmm. These 2 points look as a bug. Can you send me the angles?
 

Absolutely. This issue happens for Rotate(100,45) and angles in that region. I plotted Area() with the mgls_prepare1d function for y, and then x and z are in the interval [-40,40]. If I do a Rotate(100,45), the tick labels for all three axes appear on the wrong side.

OK. I'll add transparency for the Area, Bars, and similar 1D functions.

Thank you, that may be useful.

Yes, I mean that this kind of graph with a 3d perspective is usually done with bars instead of cones. Maybe I'm being to pedantic here. If you think it's not worth it, just ignore me :)

Grid() function do exactly this.

Ah, of course! I experimented with Grid(), but unfortunately I forgot to remove the Box() function from my plot, so I didn't notice the difference. Sorry about that :(
 

Thank you as always for being so helpful.

Jan

legro jan

unread,
May 14, 2013, 4:09:05 AM5/14/13
to mat...@googlegroups.com
I forgot to add that the Colorbar issue with the labels can be seen in the "Manual colors" subplot of the Colorbar examples from the manual (on page 25). The left and right colorbars collide with the labels. The labels should either be drawn on the other side of the bar, or in the opposite direction.

mathgl....@gmail.com

unread,
May 16, 2013, 2:26:40 AM5/16/13
to mat...@googlegroups.com
Hi,

I've added following styles for Cones() plot:
'4' -- use square "cones" (pyramid)
'6' -- use hexagonal "cones"
'8' -- use octagonal "cones"
't' -- use tubes instead of cones.

So, the plot you are looking can be created by call Cones(ydat, "4t"); and so on.

This features are available since SVN rev.739. For samples, see https://sourceforge.net/p/mathgl/code/HEAD/tree/mathgl-2x/examples/samples.cpp -- function void smgl_cones(mglGraph *gr).



2013/5/14 legro jan <legr...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "MathGL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathgl+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

legro jan

unread,
May 16, 2013, 10:22:16 AM5/16/13
to mat...@googlegroups.com
Wonderful, thank you very much

/Jan

legro jan

unread,
Jun 21, 2013, 7:33:39 AM6/21/13
to mat...@googlegroups.com
Hi,

I have found a similar issue to the one I posted about the axis tick labels. When I add a certain spacing between the tick labels and the axes (with SetTickShift), sometimes the labels get shifted, not outwards, but up or down. This issue can be seen in the two pictures attached, where the Y and Z axis tick labels are displaced up or down from the place they should be. The X labels are displayed correctly.

This is again depending on the rotation angles.


Regards,

Jan
plot1.jpg
plot2.jpg

mathgl....@gmail.com

unread,
Jun 25, 2013, 3:43:58 AM6/25/13
to mat...@googlegroups.com
Dear Jan,

I'm sorry for delays with answers -- I'm in vacation now and don't look my e-mails often.

Concerning previous bugs about labels of colorbar and axis -- I hope I fix it in some of SVN commits. Can you check this?

Another question: which angles you are using for these pictures? Is it reproducible on recent SVN revision?



2013/6/21 legro jan <legr...@gmail.com>


Jan

--
You received this message because you are subscribed to the Google Groups "MathGL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathgl+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

legro jan

unread,
Jun 26, 2013, 4:51:15 AM6/26/13
to mat...@googlegroups.com
Dear Alexey,

First of all, no need to apologise, I wish everyone on the net were half as attentive and helpful as you are. Besides, we all have lives away from the computer.

I have compiled the latest SVN (rev 767) to check the issues that I mentioned before, and most of them are indeed gone. The only trouble I'm having now is with the tick labels. It is slightly different than the last issue I reported. For some angles, the tick labels seem to be shifted. I realised, after a careful examination, that the rotated labels start at the same point as the normal, non-rotated ones.

For instance, when I do Rotate(30,-26), everything is fine. For Rotate(30,-27) the axis labels get rotated too (see attached figures). That is correct in this case, I think. However, the "-" from "-150" starts at the same point in both cases, thus in the last plot, the tick labels seem to be shifted towards the negative axis values.

Something similar, but more drastic, happens for Rotate(30,26) and Rotate(30,27). The first is fine, the second has the same problem as for (30,-27) but in addition, they are pointing in the opposite direction, so it's not the "-" from the -150 that is in the same position as before, but the 0. Again, this results in the appearance of the labels getting shifted. This time, they also get closer to the axis, since they are drawn upwards.

I hope this makes sense. Depending on the theta angle, this happens for different phis. For example, Rotate(36,25) is ok, and Rotate(36,26) is wrong.

Please let me know if you need any more clarification.

Best regards,

Jan
30-26.jpg
30-27.jpg
3026.jpg
3027.jpg

mathgl....@gmail.com

unread,
Jun 26, 2013, 11:32:10 AM6/26/13
to mat...@googlegroups.com
Dear Jan,

This is not the bug! This is feature of automatic axis labels rotation/skipping if labels become too long. See http://mathgl.sourceforge.net/doc_en/doc_en_18.html#Axis-and-ticks . You can disable it by calling SetTickRotate(false) -- see http://mathgl.sourceforge.net/doc_en/doc_en_39.html#Ticks , or by reducing font size.



2013/6/26 legro jan <legr...@gmail.com>


Jan

--
You received this message because you are subscribed to the Google Groups "MathGL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathgl+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

legro jan

unread,
Jun 26, 2013, 12:04:45 PM6/26/13
to mat...@googlegroups.com
Hi again Alexey,

I am aware that the tick labels will be rotated automatically, this is expected as well as convenient. However, if you take a look at the images, you will notice that the rotated labels are not at the right place. They are shifted. Sorry that I didn't make myself clear in my last post. I am aware that it's a difficult issue to address with static images and through a discussion group. I can provide you with more information if you want, like for instance the data I used to produce the images.

Thanks,
Jan

mathgl....@gmail.com

unread,
Jun 27, 2013, 3:30:41 PM6/27/13
to mat...@googlegroups.com
Dear Jan,

yes labels are placed non-optimal in this cases. I'll look on it in more detail.


2013/6/26 legro jan <legr...@gmail.com>

Jan

--
You received this message because you are subscribed to the Google Groups "MathGL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathgl+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

legro jan

unread,
Jul 9, 2013, 4:58:46 AM7/9/13
to mat...@googlegroups.com
I found one more thing, concerning Colorbar this time. Colorbar("A>") works fine, but Colorbar("A>I") makes the bar collide with the graph.
ReEx.jpg

mathgl....@gmail.com

unread,
Jul 23, 2013, 2:47:22 AM7/23/13
to mat...@googlegroups.com
Dear Legro,

Ops this is my mistake (I forgot about rotation here). I'll fix it shortly. Thank you for the bug.


2013/7/9 legro jan <legr...@gmail.com>
I found one more thing, concerning Colorbar this time. Colorbar("A>") works fine, but Colorbar("A>I") makes the bar collide with the graph.

--
You received this message because you are subscribed to the Google Groups "MathGL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathgl+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Hanle

unread,
May 20, 2021, 3:30:24 AM5/20/21
to MathGL

hello,  Excuse me , Whether MathGL can use the mouse to drag  any Angle to view the 3D image, do not need to Rotate the specific Angle of view
Reply all
Reply to author
Forward
0 new messages