Graphite: multiple series with a single command - graphite

I would like to put two series in the same graph on the graphite dashboard. However, since the dashboard requires single-line commands I could not find a way that doesn't involve the use of a wildcard.
Here's an example of the two series I would like in the same graph:
sum(base.foo.bar.positive.*)
sum(base.foo.bar.negative.*)
I tried several separators but I could not get it to work. Any ideas?

You have a few options here...
Merge the 2 graphs on to the graph via the drag and drop in the dashboard
OR
Use the sumSeriesWithWildcards() function
Merge 2 or more wildcard matching
Open your first graph on the dashboard
Open your second graph on the same dashboard
Click and hold the second graph and drag it over the first graph
Use groupByNode() and wildcard matching
This is not as nice, and will not always work however you will be able to do this all in one line.
sumSeriesWithWildcards(base.foo.bar.{positive,negative}.*, 3)
This will do the following:
Select all all the graphs that match base.foo.bar.positive.* and base.foo.bar.negative.*
Sum the data by the node at position 3: positive, negative
You might want to have a read over the following page: http://graphite.readthedocs.org/en/1.0/functions.html

Related

Tableau - Plotting multiple lines in one graph

I'm trying to plotting multiple lines in one single graph. I've combined two of them using dual axis, but I don't know how should I add another.
Thank you in advance for any help.
Since you have mentioned that you want to show multiple measures in one viz it means that one axis is sufficient for all these measures. Therefore, Instead of creating dual axis chart, do it like this-
Step-1 Build line chart with one measure.
Step-2 Drop another measure on the axis directly instead of rows/column shelf where you'll see a double bar icon like the screenshot.
step-3 Drop additional mesaures either in similar ways or onto measure values pane created automatically. See a demonstration screenshot below on sample superstore

How to draw multi-lines from multiple queries in Kibana

I am new to Kibana and need some help.
I can draw this line chart for a single query (java):
Now I would like to another line for another query (for example python) in the same chart. I am not so sure how to do that. Also "Markdown widget" is the way to add a legend?
Any help would be appreciated.
It is possible by adding the followings:
X-Axis -> Split Lines -> Sub Aggregation -> Filters
In the filters, you can add multiple ones such as query:java, query:react and so on.
As far as data is from same index we should be able to do it.
Any chart visualization edit buckets configuration will have option to split line/chart using that you can do split lines.Here you can do split by attribute also if you want to go with date you can go with following steps in high level.
In Visualize, select Line Chart
For Y-Axis, select "Average", then select PRICE -- note, you can't plot the exact prices, it has to be some bucketing function
In X-Axis, select "Date Histogram", then select CHK_IN_DATE
Then select "Add Sub-Buckets", select "Split Lines", select "Terms", select "SOURCE_SITE_C"
You should get something similar to the screenshot below.
If your graph ends up being too messy with more lines than you expected, switch the order of steps 3 and 4 (or just use the arrow keys to switch the order of operations, see this blog80 for explanation)

Plots of different rows on the same graph

I found an interesting thread about plotting but I'm not happy with the answer. I would like to plot different amount of rows on the same graph. Just giving me the possibility to add as much rows as I want to.
I'd like to use glopts library but I am open for any other. First of all I want to plot those rows into pdf file. The script which I want to modify is:
which_rows <- c(12,156,4432) ## I want to choose which row I want to plot
pdf(file='Plots'.pdf)
x <- 1:(ncol(data_plot)-1) ## Can it be changed to use the name of the columns instead of pure numbers ?
for(i in which_rows){
## create new pdf page BUT I WANT TO PLOT IT ON THE SAME GRAPH!
plot(x=x,y=data_plot[i,-1],type='b',main=data_plot[i,1],xlab='columns',ylab='Intensity')
}
# closing pdf
dev.off()
Can you help me to modify this script to print just all of the rows which I decide on the same graph ? Would be great if you show me how I can jsut add new page in this pdf file using the other set of rows like which_rows2.
Of course each plot should has diffent colour or something.
Edit:
use points()to add points to the existing plot

LocusZoom standalone change x-axis and use the plots in a script

I am using the standalone LocusZoom software,but I am having two problems:
I have to create a plot showing only position on the x-axis (not showing the genes). If I just use showGenes=FALSE with nothing else the genes still appear, but if I use rfrows=0 then the genes are not shown, but the problem is that also the x-axis label with the positions disappears. Is there a way to only show the position label? It looks like the only way to do this is to modify the original script...
Is there a way to use several plots created using LocusZoom in an R script to position many plots into one unique figure? (output is a pdf for now) There is an option listed in the LocusZoom webpage (http://genome.sph.umich.edu/wiki/LocusZoom_Standalone) called "prelude" but I cannot get more info on how to use it.
If you have any suggestions for either of these two issues it would be very helpful! Thanks!!

Update a plot in R

I have an R script that takes in a dataset and a list of keywords. It then creates a plot based on how many times each of the keywords occur in the dataset, and saves it as a png image. Now, I want to make the keyword list dynamic, i.e. I want the keywords to be user inputs. Somehow, in the environment I am working in, it so happens that once the user has entered a list of keywords, I execute the R script and present the user with the plot. Now when the user enters some more keywords, they are appended to the previous list and since the complete list of keywords are sent to the R script, it performs the complete task again. It is obvious that it is doing a lot of unnecessary work of finding the keywords that were there in the first run too.
For example, in the first run, list of keywords:- "One", "Two", "Three".
In the second run, list of keywords:- "One", "Two", "Three", "Four", "Five", "Six"
In the second run, it wastes a lot of time working on keywords "One", "Two" and "Three".
Since the dataset will be huge and so will the number of keywords, it will take a lot of time to execute.
My question is, is there a way I could prevent this, retain the previous plot and modify the previous plot to present the new keywords as well?
In theory it is possible to read in a png file and use it as a background, then add additional points/lines to it, but it would be much more complicated (and probably produce much uglier results) than saving the information to create the plot and just recreating the plot from scratch.
To do this (using base graphics) you could read the existing png file using the readPNG function from the png package. Then create a new plot using plot.new and plot.window. You would then need to use par to set the plotting region to the entire device region. Then use rasterImage to plot the png file as a background. Now you need to use par again to set the plotting region and user coordinates to match the previous png plot (this could be the most complicated part and if you don't get it right then the results will be all wrong). Then you can use points and lines to add to the plot. Note that the quality of the points and labels from the first plot will probably decrease every time that you do this (a png file does not save the text, but rather information on what colors to make which pixels).
It would be better (as mentioned in the comments) to just save the information needed to create the plot, then recreate the plot with the added information.
You could also look at the ggplot2 package which stores all the information to create a plot in an object, then plots it when printed. You can add (using +) options, data, etc. to the plot information and it will take care of the replotting.

Resources