Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In Mathematica 10.0.0 we have built-in graphical triangle PlotMarkers. Let us look closer on them:

ListLinePlot[{{Missing[]}, {{0, 0}}}, PlotTheme -> "Monochrome", 
 ImageSize -> 10, Ticks -> False, AxesOrigin -> {0, 0}, 
 BaseStyle -> {Magnification -> 10, Thickness -> Tiny}]

screenshot

It is clear that there is something wrong with the triangle. Is this functionality implemented correctly?

share|improve this question

1 Answer 1

up vote 15 down vote accepted

It is natural to expect that the triangle marker is placed in such a way that its center of mass (center of circumcircle) coincides with the point it marks. That's how it is implemented in all major scientific plotting software, for example Origin. Some time ago I published my own implementation of triangle-based plot markers. Let us check how new markers are implemented:

ListLinePlot[{{Missing[]}, {{0, 0}}}, PlotTheme -> "Monochrome", 
 ImageSize -> 10, Ticks -> False, AxesOrigin -> {0, 0}, 
 BaseStyle -> {Magnification -> 10, Thickness -> Tiny}]
%[[1, 2, 2, 2, -1]] // InputForm

screenshot

GeometricTransformation[Inset[Graphics[{<...>
      Line[{Offset[{0., 2.7625}], 
        Offset[{-2.7625, -2.022290355909023}], 
        Offset[{2.7625, -2.022290355909023}], 
        Offset[{0., 2.7625}]}]}], {0., 0.}],
     {{{0., 0.}}, {{0., 0.}}}]

Apart of the fact that the curve is not closed, the triangle is positioned in a strange way: the "center" is placed on the

2.022290355909023/(2.7625 + 2.022290355909023)

0.4226497308103742

part of the height of the triangle instead of expected 1/3 (the center of circumcircle). So current implementation is clearly wrong and leads to producing incorrect plots. Here is an example of correct implementation:

Graphics[{AbsoluteThickness[1], JoinedCurve[
   Line[{Offset[{0, 2}], Offset[{Sqrt[3], -1}], 
     Offset[{-Sqrt[3], -1}]}], CurveClosed -> True]},
 ImageSize -> 10, Axes -> True, Ticks -> False, AxesOrigin -> {0, 0}, 
 BaseStyle -> {Magnification -> 10, Thickness -> Tiny}]

screenshot

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.