- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
JSL code to save picture is causing me to loose plot formatting color/marker/legend etc. please help
Hi,
I am using the following code to try and save a picture of a varibility and time trend plots and it works but for some reason I loose the plots formatting, color/marker/legend etc. In this case Flagging_Charts_Data_Var and Flagging_Charts_Data_Bivar are the handles for my variability and time trend plots.This is probably something easy I am missing, please help, Thanks!!!
//Code to try and save my plots as png
Summary_Data_Flagging_Window = HListBox(Flagging_Charts_Data_Var,Flagging_Charts_Data_Bivar);
Summary_Data_Flagging_Window << Save Picture(file_name,png);
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL code to save picture is causing me to loose plot formatting color/marker/legend etc. please
Congratulations!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL code to save picture is causing me to loose plot formatting color/marker/legend etc. please
My first thought is that the plots might not be finished drawing with your custom formatting before the picture is saved. I am not taken the time to understand exactly when it is necessary but I make a point to send '<< update window' before every image capture or save just to be safe.
This is an overly complex example, but this 3D Plot Tools add-in uses update window. You can jump right to the source code on GitHub; search for "update window" to find the relevent lines (currently 145-148). In this case, the update window message is sent to a 'Scatterplot 3D' window before the graph inside that window is captured as an image.
//rotate the scatterplot
sp[1] << Frame3d( Set Rotation( x, y, z ) );
//make sure the plot is redrawn
sp[1] << update window;
//take a picture
img = (sp[1] << Find( Picture Box(1) )) << Get Picture;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL code to save picture is causing me to loose plot formatting color/marker/legend etc. please
Thanks for the reply, I don't think that the speed is the issue, I am think that there is something with the way you have to send the plot to the save picture() command but I am not familiar enough with JMP to know the answer, please if anyone else can help? Thanks, Matt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL code to save picture is causing me to loose plot formatting color/marker/legend etc. please
Matt,
Try the attached script. You will need to change the path, if you do not have a c:/temp/ drive. Check to see if the color of the saved was removed.
Based upon experience, I have seen only these problems regarding colors:
- The script is run, and before the save picture, a data table clear rows states is called. In the script, you will see the statements varpic = report(varchart)[OutlineBox(2)] and bivpic = report(biv)[OutlineBox(1)]. Often people new to JSL think that this is capturing the graph as is, but in fact it is only creating a handle to the active (live) window. So any changes to the data table row states will be reflected on the graph when the save occurs.
- Graph customizations are made to the frame box using variables. Those variables (not their values) are stored. If the variables change or are deleted prior to saving the picture they will not show up in the picture.
- There was one instance about 8 years ago, where JMP output as well as other statistical graphic output always came out black and white. It was on a server where a default printer or graphics card had not been defined. I saw this only once.
So if the attached script saves the colors, and you are saving the pictures before closing or changing row states, then it might be the way you reference the graphs. If the colors are stripped from the twopics.png, then it is a system thing.
You should note your OS and version of JMP. Good Luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL code to save picture is causing me to loose plot formatting color/marker/legend etc. please
Thanks for the excellent explanation and help, when I run the script you attached it works fine, however when I updated my code it created .png file's that were blank, maybe I am still missing something? Should I not be using outlinebox[1]? I am using JMP Pro 11.1.1 on Win8. I am also putting the entire code inside a loop to create multiple .png pictures, do I need to update the varpic or bivpic variables every time through the loop or the summarywindow? Thanks so much again I think it is getting closer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL code to save picture is causing me to loose plot formatting color/marker/legend etc. please
nevermind figure it out, Thanks again!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL code to save picture is causing me to loose plot formatting color/marker/legend etc. please
Congratulations!