Don't know if this sort of question belongs to this forum, but I will give it a shot:
I have started using bokeh as an alternative to be able to share Python-generated data and plots in between my colleagues (who don't necessarily have Python, or any knowledge of the language for that matter).
Since some of the data I am using could potentially be proprietary, I would like to now how the data is actually stored when outputted from Python as a html-file?
Moreover, will anyone outside of my organization be able to get a hold of the data that the file is built up on? Meaning, is the person double-clicking on the .html-file, running it through her Chrome/Explorer the only one that can access the data that is generated in the plots etc., or could someone potentailly snoop the data externally?
Using Python code as in:
from bokeh.io import output_file
output_file('data.html', title="test data")
Thank you, and hope it's not a too a lame/bad question for this forum.
When you set the output_file and save the HTML file it is all done so locally; I don't believe it is shared to a cloud service (like plotly).
The HTML file will contain the original data used to produce the plots. If that concerns you, you can save snapshots of the plots with the save button on the toolbar.
Related
I am working on creating an app that access PLC to gather data and then display it on the screen with the option of viewing the data as an interactive graph. There has been some work done in python that collects data, store them in excel and at the end process the data to get some meaning full data points and visualization using matplotlib.
They have used tkinter to be the interface to get data and display the current values on 2 screens, I have plans to update the program to store the data in a database and query them as per the needs using python.
What would be the ideal GUI package and the data visualization tools I can use to make the app interactive and easy to use on a PC?
As for as why I chose python, I feel comfortable using python.
Thank you guys in advance!
It's not a free solution, but you might want to look at Ignition [link]
I have been using it for several years now and it has some great depth and flexibility for capturing data from most brands of PLCs and then displaying the data on a HMI, webpage, uploading to SQL, and so on.
The scripting language is jython, so you should feel very comfortable there. You can also try if for free for two-hours at a time. Then reset the trial as many times as you like.
I'm new in Python, try to develop gui app. My data source is from serial port. When i pressed buttons, it should plot graphics and print it on the screen and print to new txt file.
All of above that i mentioned should do separetely.
My expected is: How can i run both saving data and plotting many graphics concurrently from same resource
I used threading, time.sleep, wx.Timer. but I couldn't succeed on it. Anybody can help me? Thanks a lot.
You can certainly use a wx.Timer event to fetch the latest data from the serial port. With that data, you can stream it to an open file and update a graph of the data.
Without a more detailed question, it's hard to give a detailed answer. But, you may find the wxmplot library (https://newville.github.io/wxmplot/) useful. In fairness, I am the lead author of that library. One of its features I use it for is very similar to your need: "live updated plots" of data from an external source, and without recreating a new matplotlib figure for each new data set.
You might find the example at https://github.com/newville/wxmplot/blob/master/examples/stripchart.py to be a useful example. It has a function that simulates data, but you can replace this with "read from serial port" or fetching other data sources.
I am using Spyder to edit python code. I plotted a figure like following on my screen:
As you can see I have zoom-in on my menu by playing which I can magnify a ROI like following:
Now I need to send this figure to another person who'd like to view this figure interactively, say do zoom-in/zoom-out as well.So my question is, is there anyway to send this figure in certain format the other person can play with such that me without sending my entire python code?
I tried to the save icon on the menu bar, but I did not see a format that can do what I want. I am new to python, please advice. Thank you.
PS: I think in MATLAB you can do that by saving the figure in certain format, so that as long as the other person has MATLAB installed, he/she does not need the data to see the figure interactively
You need to use the pickle module.
MATLAB saves the figure in a .fig format. This is really just a .mat MATLAB data file with a different extension so MATLAB knows it stores image data. If you change the extension to .mat, you can open it is a refular MATLAB data file and see that it just contains variables storing image information.
The equivalent thing to do in matplotlib is to use the pickle.dump function to save the matplotlib figure object to a file. Someone else can then just load the figure from the file and show it. Although the other person may need to have the same matplotlib version installed.
A better option would be to use something like bokeh to save an interactive HTML plot.
I believe its too late for an answer whereas I think it will help others.
In python, if an interactive figure is plotted in plotly. Then it can be exported as a .html.
For reference please follow official documentation Interactive HTML Export in Python
.
I hope it helps.
Does anyone know how to export RCloud notebooks (not RStudio) to a common format? I’m using it for a project to try to predict if a car will statistically be a good purchase or a lemon, and I’m learning - so I’m trying a lot of new/different code and packages to make graphs, regression charts etc.
I’m new to RCloud so I want to save this notebook as a reference document/cheat sheet on my laptop so I can ‘reuse’ the common R commands I used (e.g. how to use "lapply" command to change vectors to numeric like “mycarsub[, 1:6] <- lapply(mycarsub[, 1:6], as.numeric”, "na.omit", etc. I just want a reference to use for other projects or notebooks in Rcloud, RStudio etc.
So I’m wondering if anyone knows how to export it in Text format that is searchable or easily read with common apps (outside of RCloud, or RStudio)? Like export to Word/Libreoffice, HTML etc?
I tried “Share” at the top but think it only exports R file types, I’m probably doing it wrong. Or if you have another way to accomplish what i'm trying to do. I cut and pasted but doesn't work all the time (user error?). I searched Stack Overflow but only got RStudio or R developer code exporting via API's etc. Hope this is enough info, first post.
RCloud was created for making it easier to share code and for others to learn from existing code so it includes the ability to search code using Lucene search syntax. Rather that creating another document to keep track of, I would suggest opening multiple RCloud tabs - use one to search, cut and paste from and the other to code in; you can create multiple tabs by copying and pasting any notebook URL into a new tab.
If you prefer to have a separate document, you can export the RCloud notebooks as an R Source file or a Rmarkdown file using the Advanced menu located in the navigation bar at the far right.
When selecting a data source for a graph in Excel, you can specify how the graph should treat empty cells in your data set (treat as zero, connect with next data point, leave gap).
The option to set this behavior is available in xlsxwriter with chart.show_blanks_as(), but I can't find it in openpyxl. If anyone knows where to find it or can confirm that it's not present, I'd appreciate it.
Asked the dev about it -
There is a dispBlanksAs property of the ChartContainer but this currently isn't accessible to client code.
I looked through the source some more using that answer to guide me. The option is definitely in there, but you'd have to modify source and build locally to get at it.
So no, it's not accessible at this time.