Skip to content

added option to tikz.py Plot to plot data from files #262

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion pylatex/tikz.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,9 @@ def __init__(self,
func=None,
coordinates=None,
error_bar=None,
options=None):
options=None,
table=None,
data=None):
"""
Args
----
Expand All @@ -515,6 +517,18 @@ def __init__(self,
A function that should be plotted.
coordinates: list
A list of exact coordinates tat should be plotted.
table: dict
dictionary of specification of the data which should be plotted from csv file
csv: x_axe y_axe
0 4
1 1
2 5
3 4
table = {x:'x_axe', y:'y_axe}
cannot be used together with coordinates!

data: string
path to file with csv data

options: str, list or `~.Options`
"""
Expand All @@ -523,7 +537,10 @@ def __init__(self,
self.func = func
self.coordinates = coordinates
self.error_bar = error_bar
self.table = table
self.data = data
self.options = options


super().__init__()

Expand Down Expand Up @@ -554,11 +571,20 @@ def dumps(self):

string += '};%\n%\n'

elif self.table is not None:
string += ' table['
for key, value in self.table.items():
string += '{0}={1},\n'.format(key, value)
string += ']'
string += '{{{0}}};\n'.format(self.data)

elif self.func is not None:
string += '{' + self.func + '};%\n%\n'

if self.name is not None:
string += Command('addlegendentry', self.name).dumps()



super().dumps()

Expand Down