Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matplotlib 'markevery' is not translated into PGFPlots #94

Closed
Duesterwald opened this issue Mar 18, 2016 · 1 comment
Closed

matplotlib 'markevery' is not translated into PGFPlots #94

Duesterwald opened this issue Mar 18, 2016 · 1 comment

Comments

@Duesterwald
Copy link

Plotting dense data with the 'markevery=' should result in plots where not all data points are drawn with a marker, as described in

http://matplotlib.org/api/lines_api.html#matplotlib.lines.Line2D.set_markevery

However, matplotlib2tikz does not regard this. It could be done using the 'mark repeat' option or even 'mark indices' (see PGFPlots manual pp. 179-180)

Minimal example:


import matplotlib.pyplot as pp
import matplotlib2tikz as m2t

pp.plot(range(10), range(10), marker='o', markevery=3)

m2t.save('mark.tikz')

gives the output

% This file was created by matplotlib2tikz v0.5.6.
% The lastest updates can be retrieved from
% 
% https://github.com/nschloe/matplotlib2tikz
% 
% where you can also submit bug reports and leavecomments.
% 
\begin{tikzpicture}

\begin{axis}[
xmin=0, xmax=9,
ymin=0, ymax=9,
axis on top
]
\addplot [blue, mark=*, mark size=3, mark options={draw=black}]
table {%
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
};
\end{axis}

\end{tikzpicture}

It should give something like

% This file was created by matplotlib2tikz v0.5.6.
% The lastest updates can be retrieved from
% 
% https://github.com/nschloe/matplotlib2tikz
% 
% where you can also submit bug reports and leavecomments.
% 
\begin{tikzpicture}

\begin{axis}[
xmin=0, xmax=9,
ymin=0, ymax=9,
axis on top
]
\addplot [blue, mark=*, mark size=3, mark repeat=3, mark options={draw=black}]
table {%
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
};
\end{axis}

\end{tikzpicture}
@nschloe
Copy link
Owner

nschloe commented Apr 11, 2016

Fixed by PR #98.

@nschloe nschloe closed this as completed Apr 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants