JuliaTeX / PGFPlots.jl

This library uses the LaTeX package pgfplots to produce plots.
Other
187 stars 36 forks source link

Ellipse and Circle plots are empty if nothing else is on axis #24

Closed zouhairm closed 8 years ago

zouhairm commented 8 years ago
Plots.Ellipse(2500,0,1000,2000, style="fill=red, draw=black, very thick, rotate around={45:(2500,0)}"))
save("/tmp/test.tex", p)
p

The above produces an empty plot. This seems to be caused by the fact that the resulting .tex (see below) is effective a \draw inside of an axis, and tikz struggles with that if the axis bounds are not defined (http://tex.stackexchange.com/questions/210821/draw-not-working-inside-axis-environment) Same issue with Circle plots since they also generate \draw commands.

The following is a workaround:

R = 5000
p = Axis([Plots.Ellipse(2500,0,1000,2000, style="fill=red, draw=black, very thick, rotate around={45:(2500,0)}")],
xmin = -R, xmax=R,ymin=-R,ymax=R)
save("/tmp/test.tex", p)
p

Resulting .tex:

\documentclass[tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \pgfplotsset{every axis legend/.append style={% cells={anchor=west}} } \usepgfplotslibrary{polar} \usetikzlibrary{arrows} \tikzset{>=stealth'}

\begin{document} \begin{tikzpicture}[ scale=2] \begin{axis}[view = {{0}{90}}]\draw[fill=red, draw=black, very thick, rotate around={45:(2500,0)}](axis cs:2500, 0) ellipse[x radius=1000, y radius=2000]; \end{axis}

\end{tikzpicture} \end{document}

zouhairm commented 8 years ago

Seems like the documentation says something about this (in the provided example, the bounds are defined). It would be nice to not have to explicitly pass that, but it's ok I guess.

Not holding me up, so feel free to close as "non-issue", especially since this is technically an upstream issue with tikz.

mykelk commented 8 years ago

Without the limits being specified by an axis environment, it is not clear what the limits should be. Right? One might be tempted to use the position and radius information, but it would get it wrong with the rotation command. I'm tempted to close as a non-issue.