Jump to content

Push plot from DataLab to Organizer?


patjdixon
 Share

Recommended Posts

I have DataLab code that generates a plot:

image.thumb.jpeg.b00a26329452311c2861d1bc08a0fd8b.jpeg

I thought there was a way in DataLab to push "ax" to an Organizer topic/sheet, but I can't find any information on how to do this.  The result I am looking for would be like:

image.thumb.jpeg.c69dc10943b6c9d17c2b861a594caa1f.jpeg

Is there a way to do this, or do I have to export an image from DataLab and then manually import it into Organizer?

Link to comment
Share on other sites

  • Seeq Team

Hi patjdixon - You do have the ability to push images directly into an Organizer Topic.  To do this, first save the image using plt's savefig method:

Lab_Pred_Fig.savefig('Awesome_Chart.png')

Create an Organizer Topic Object:

topic = spy.workbooks.Topic({'Name': "Charts"})

Add a page to the topic object:

page = topic.document('Visualizations Using Data Lab')

Add the image to the page.  Note the semicolon on the end suppresses the output from the cell.

page.document.add_image(filename='Awesome_Chart.png', placement='end');

Publish the Topic:

spy.workbooks.push(topic)

 

If you have an existing Topic, you can use spy.workbooks.pull() to pull in the object and follow the same methodology as above.  Note I included a [0] index to reference the Topic document in the pull results.

topic_search=spy.workbooks.search({'ID':'DFFC7BB8-9EE3-42DD-937A-2CE2FAAAB0E8'})
topic=spy.workbooks.pull(topic_search)
page = topic[0].document('Visualizations Using Data Lab')

 

  • Like 1
Link to comment
Share on other sites

This is great, but in my case I already have a topic and worksheets created.  What I would like to do is append the end of each Organizer worksheet with the appropriate plot.  For example, my worksheets could be 'Tensile' , 'Burst', 'Tear', and 'Fold'.  On each one, I want to append the plot of the property to the worksheet, so 'Tensile' would have a plot of Tensile, 'Burst' a plot of Burst, etc.

I cannot figure out a way to do pull/push to make this work.  Any ideas?

Link to comment
Share on other sites

  • Seeq Team

You can append to existing topics/documents (pages) by first pulling the Organizer topic, and then adding to the respective page:

 

#Search for topic (I used the Topic ID, but there are other options as well):
topic_search=spy.workbooks.search({'ID':'DFFC7BB8-9EE3-42DD-937A-2CE2FAAAB0E8'})

#Pull the topic associated with that ID.  This creates an object of the Organizer that you can modify.
topic=spy.workbooks.pull(topic_search)

#Extract the "Tensile" page so you can modify it
tensile = topic[0].document('Tensile')

#Add image to the "Tensile" page
tensile.document.add_image(filename='Awesome_Chart.png', placement='end');

#Push modified Organizer back to Seeq:
spy.workbooks.push(topic)

Let me know if this works!

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...