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

Recommendation for visualization package/tool #226

Open
ThomDietrich opened this issue Nov 25, 2019 · 3 comments
Open

Recommendation for visualization package/tool #226

ThomDietrich opened this issue Nov 25, 2019 · 3 comments

Comments

@ThomDietrich
Copy link

Hey guys,
great project! Could you tell me which package/tool was used to generate the diagrams shown in README? Which other packages do you use in combination with traces? Would it be useful for others to mention a few of these in the README?

Best!

@stringertheory
Copy link
Owner

Thanks for the note! The plots were generated with Grace, which is simple plotting program that's easy to pipe stuff to on the command line (it's showing its age, but remains useful for quick n' dirty plots).

It's a good idea to mention some possibilities in the documentation.

@johnhaire89
Copy link

johnhaire89 commented Aug 25, 2020

Can the Grace library be handled to plot discontinuities? If not, are you able to say how you plotted the discontinuous jumps?

Admittedly I haven't tried anything yet, but I'm expecting that the default behaviour of virtually every plotting library is to draw straight lines between successive points. In data like your examples, values are assumed to be held constant until a new value is reported, resulting in a discontinuous jump.

Edit: Looks like I'm trying to generate a step plot
Edit2: This answer on stackoverflow gives very simple instructions on how to draw a step plot using pyplot and my code ended up looking like:

import traces
from datetime import datetime
import matplotlib.pyplot as plt
import random

dt_start = datetime(2020,8,18,0,0,0)
dt_end = datetime(2020,8,24,0,0,0)

num_traces = 20
num_samples = 12 # per trace

trace_list = []
for i in range(num_traces):
    trace = traces.TimeSeries(default=random.randint(0, 1))
    for sample in range(num_samples):
        # Generate random time stamp between dt_start and dt_end
        # https://stackoverflow.com/a/50165564/6713868
        dt = random.random() * (dt_end - dt_start) + dt_start
        trace[dt] = random.randint(0, 1)
    trace_list.append(trace)

summed_traces = traces.TimeSeries.merge(trace_list, operation=sum)
x_values, y_values = zip(*summed_traces.items())
plt.plot(x_values, y_values, drawstyle='steps-post')
plt.show()

more edits (sorry for spamming edits!): should've used steps-post instead of steps-pre

@ThomDietrich
Copy link
Author

Picking this up again.
@stringertheory a documentation page with detailed descriptions (e.g. this is how you export traces into a csv) would for sure be overboard and out of scope. How about a short bulletpoint list with "ideas" what traces objects can be used for

  • export to csv
  • export to a database
  • directly pipe to X

What would you guys add?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants