Is it possible to embed [bokeh] high level charts? - embed

It seems most Bokeh embedding examples are using bokeh.plotting.figure object. Is it possible to embed a high level chart, like bokeh.charts.Bar or bokeh.charts.Scatter? Or is it possible to have convert a high level chart to a bokeh.plotting.figure object?
Thanks a lot.

The User's Guide section on Bokeh APIs has a good run down of how all these parts fit together, that I would suggest reading.
The long-story-short: Regardless of what API you use, bokeh.plotting or bokeh.charts, the end result is always just a collection of the same low-level bokeh.models objects. You can can think of bokeh.models as very basic building blocks, and the other higher level APIs as conveniences that help you to assemble the building blocks more efficiently and correctly.
So, in that light, yes, it is perfectly fine to embed a bokeh.chart using exactly the same functions described in Embedding Plots and Apps.
The one thing I will add is that if you need to update the plot's data after the fact, in place, then the bokeh.figure API will probably be more straightforward. The mapping between your data, and what gets plotted is more direct. Things generated by bokeh.charts may transform your input data into entirely different forms before plotting (e.g. you give a series, and Histogram has to spit out coordinates for boxes—not the data you started with)

Related

Interactive and changable images in Google Sheets

I have to create a fictional map as a visual representation for a particular community in a video game that I would not disclose.
The map would have multiple landmarks that requires to be drawn a radius around it, creating a circle. This circle should change in color depending on certain events that occurred, often monthly.
The reason why it is in Google Sheets was the data that is being collected from the game is needed to be calculated and graphed alongside the said interactive map.
I can confidently say that no one have perform this sort of thing with Google Sheets before.
My skills are essentially beginner-level, so if there are some topics that are outside the scope of general amateur skillset, please describe it for me.
I first thought that I could simply overlap images together, but images in Google Sheets can't change it's position in the sheets through the app-script, like placing it in a coordinate system. Because there are many landmarks that are needed to be drawn a circle around with multiple different kinds of color existing in the palette, it's not exactly a good idea to have all possible combination of different landmarks or color of the circle and then display one correct one out of hundreds of possibility.
Changing the color can be manually be dealt by hand, as monthly changes are not difficult to perform.
If there are other more suitable program for this job, please let me know!
What you have is GIS data (see GIS community at Stack Exchange), and you need to visualize it.
I don’t know what kind of raw data you have but you can probably load it directly to a GIS program like QGIS (link to site) to visualize it, or even do things like heat maps or aggregations without need of programming.
If it doesn’t have an specific functionality that you need and there’s no plugin that does so, you can also make a content service (see documentation on how to do so) that returns a GeoJSON with points on the landmarks with the computed data as extra information. Then I’d use the program to visualize it. This obviously requires programming.
If for some reason you cannot install a program, you could also make a WebApp (see documentation on how to do so) and use a GIS library (Leaflet, for example) to make a visualizate of the data. In this case the data would be fetched via google.script.run. This requires even more programming.
References
Content Service (Google Developers)
HTML Service: Create and Serve HTML (Google Developers)
google.script.run (Google Developers)
QGIS webpage
Leaflet webpage

Early abandon discord searching in Time-Series using saxpy

I am trying to look for discords (the most unusual, least similar shape) in a data-set using time-series. I came across this function in the saxpy package that outputs the discord shape. However, the link above is the only documentation that I could find and the input parameters to the function haven't been explained very well there.
More specifically,
find_best_discord_brute_force(series, win_size, global_registry, z_threshold=0.01)
What do the parameters win_size, global_registry stand for?
Also, does the series parameter require me to input SAX words?
It would be great if someone could clear this up.
Thanks!
You should use the Matrix Profile instead. Is it faster and simpler, and there is free code, see this presentation
http://www.cs.ucr.edu/~eamonn/Matrix_Profile_Tutorial_Part1.pdf
series is a numpy array of the data whose discords you are looking for.
win_size is the size of the sliding window used by sax_via_window for calculating the words representing your array.
Sorry, not sure what global_registry refers to.
For further information and documentation, there's documentation on github: https://github.com/seninp/saxpy

Program to graph MySQL data

I have a fairly simple mysql database. I want to extract data from it and display as a graph to analyze it. Nothing advanced, just line diagrams and such. As a programmer I can always write some code for this myself. But does anybody know of a program that can load data (using sql queries?) and display it in various graphs?
Checkout DBPlot for Windows environment.
You can also have a look at Google Charts, if you want your graphs displayed in web pages.
Don't know what type of output you're looking for, but FusionCharts has helped me a lot... http://www.fusioncharts.com/free/
You can use GNUPLOT if you are in linux environment. I am currently using this for generating automated EOD reports which contains graphs. The graphs are drawn using the data fetched from mysql (Currently we are using in csv) But gnuplot is not as good as Fusion Chart in UI Perspective
I'd have to recommend JQplot if you want these graphs in web pages - it's non Flash (hooray!), uses JQUery (hooray!) and has some very, very cool features (hooray! - check out the examples page).
As per the docs page, you can just pass an array of values to it and it'll plot what you want, and generating an array is simple in server side languages such as PHP.
Hope this helps,
James
An extremely flexible library for graphs (images and applets) would be JFreeChart.
On the other hand, if what you actually need it is a reporting engine, Jasperreports should be your first and final stop but you will have to do A LOT of reading before starting doing something with the latter and it won't be time lost for nothing.
Try Smart chart maker it is used to create many type of charts that can be fed from a MySQL database . supported chart types include line charts , pie charts, bar charts, and scattered charts.

HTML5 Plotting Library Performance Issue on MAC?

I am looking into plotting a very large data. I've tried with FLOT, FLOTR and PROTOVIS (and other JS based packages) but there is one constant problem I'm faced with. I've tested 1600, 3000, 5000, 8000 and 10k points on a 1000w 500h graph which are rendered all within a reasonable time on PC browsers (IE and FF). But when rendered on MACs FF/Safari, starting with 500 data points, the page becomes significantly slow and/or crashes.
Has anyone come across this issue?
Yes, don't do that. It seems pretty unlikely to me that 10k points are actually going to be visible/useful to the user all at once.
You should aggregate your data (server-side) and then if they want to zoom in on areas of the data, use AJAX requests to get that area and replot.
If you use flot, they have examples showing selection, i.e. here: http://people.iola.dk/olau/flot/examples/zooming.html
(I can't comment the Ryley answer yet, that's why I put some remarks here)
What about an offline use. Html is a great format for documents, set aside the server/client stuff.
JavaScript, Canvas and all those fancy client-side technologies could be used to build nice interactive files, like data reports containing graphs with zoom and pan features ...

Drawing two-dimensional point-graphs

I've got a list of objects (probably not more than 100), where each object has a distance to all the other objects. This distance is merely the added absolute difference between all the fields these objects share. There might be few (one) or many (dozens) of fields, thus the dimensionality of the distance is not important.
I'd like to display these points in a 2D graph such that objects which have a small distance appear close together. I'm hoping this will convey clearly how many sub-groups there are in the entire list. Obviously the axes of this graph are meaningless (I'm not even sure "graph" is the correct word to use).
What would be a good algorithm to convert a network of distances into a 2D point distribution? Ideally, I'd like a small change to the distance network to result in a small change in the graphic, so that incremental progress can be viewed as a smooth change over time.
I've made a small example of the sort of result I'm looking for:
Example Graphic http://en.wiki.mcneel.com/content/upload/images/GraphExample.png
Any ideas greatly appreciated,
David
Edit:
It actually seems to have worked. I treat the entire set of values as a 2D particle cloud, construct inverse square repulsion forces between all particles and linear attraction forces based on inverse distance. It's not a stable algorithm, the result tends to spin violently whenever an additional iteration is performed, but it does always seem to generate a good separation into visual clusters:
alt text http://en.wiki.mcneel.com/content/upload/images/ParticleCloudSolution.png
I can post the C# code if anyone is interested (there's quite a lot of it sadly)
Graphviz contains implementations of several different approaches to solving this problem; consider using its spring model graph layout tools as a basis for your solution. Alternatively, its site contains a good collection of source material on the related theory.
The previous answers are probably helpful, but unfortunately given your description of the problem, it isn't guaranteed to have a solution, and in fact most of the time it won't.
I think you need to read in to cluster analysis quite a bit, because there are algorithms to sort your points into clusters based on a relatedness metric, and then you can use graphviz or something like that to draw the results. http://en.wikipedia.org/wiki/Cluster_analysis
One I quite like is a 'minimum-cut partitioning algorithm', see here: http://en.wikipedia.org/wiki/Cut_(graph_theory)
You might want to Google around for terms such as:
automatic graph layout; and
force-based algorithms.
GraphViz does implement some of these algorithms, not sure if it includes any that are useful to you.
One cautionary note -- for some algorithms small changes to your graph content can result in very large changes to the graph.