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

annotation / text does not work on timeseries graphs #21

Open
mcastorina opened this issue Nov 8, 2018 · 2 comments
Open

annotation / text does not work on timeseries graphs #21

mcastorina opened this issue Nov 8, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@mcastorina
Copy link
Owner

this may require pushing the auto-fill code from options.py into graph.py where we decide if the xcol is timeseries or not

@mcastorina mcastorina added the bug Something isn't working label Nov 8, 2018
@mcastorina
Copy link
Owner Author

@xxxserxxx
Copy link

Is there anything a user can do about this? It's not just time series. From the --bar example:

$ graph samples/bar.csv

bar

with the X-axis automagically converted to indexes. However, per the original ticket:

$ graph samples/bar.csv --annotate '1=Oranges'
Traceback (most recent call last):
  File "/usr/bin/graph", line 33, in <module>
    sys.exit(load_entry_point('graph-cli==0.1.19', 'console_scripts', 'graph')())
  File "/usr/lib/python3.10/site-packages/graph_cli/main.py", line 17, in main
    create_graph(graphs)
  File "/usr/lib/python3.10/site-packages/graph_cli/graph.py", line 323, in create_graph
    apply_globals(plt, ax, graphs)
  File "/usr/lib/python3.10/site-packages/graph_cli/graph.py", line 378, in apply_globals
    slope = get_slope(df, xcol, ycol, xpos=pos[0])
  File "/usr/lib/python3.10/site-packages/graph_cli/graph.py", line 421, in get_slope
    df['dx'] = df[xcol].diff()
  File "/usr/lib/python3.10/site-packages/pandas/core/series.py", line 2697, in diff
    result = algorithms.diff(self._values, periods)
  File "/usr/lib/python3.10/site-packages/pandas/core/algorithms.py", line 1651, in diff
    out_arr[res_indexer] = op(arr[res_indexer], arr[lag_indexer])
TypeError: unsupported operand type(s) for -: 'str' and 'str'

It's not per se a bug, but it'd be awfully useful to be able to annotate in cases when the X axis is being indexed -- for example, in this case, where the viewer would otherwise not be able to tell which index was Oranges by looking at the graph.

Is there a work-around? Or is the only solution to mangle the input data and replace the X column with a sequence?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants