FAQ Database Discussion Community


How to plot columns numbered greater than 1000 in gnuplot

plot,gnuplot
I have a file with 1600 columns. plot "file" using 1:999 title columnhead(999) plots column 999, but plot "file" using 1:1000 title columnhead(1000) produces column 100 instead of 1000, producing the same result as plot "file" using 1:100 title columnhead(100) Apparently large column numbers are wrapped. Is there a work-around...

Combine base and ggplot graphics in R figure window in different pages

r,pdf,plot,ggplot2
I used this solution to combine an R plot and ggplot and then used it in a loop to print a of these to a pdf in different pages. But for some reason the margins get bigger in every new page and at some point plots disappear. How can I...

Read CSV and plot colored line graph

python,csv,matplotlib,graph,plot
I am trying to plot a graph with colored markers before and after threshold value. If I am using for loop for reading the parsing the input file with time H:M I can plot and color only two points. But for all the points I cannot plot. Input akdj 12:00...

How to concatenate 3 histograms on the same graph in Matlab

matlab,image-processing,plot,histogram
I have calculated 3 histograms for an rgb image using imhist function in Matlab, one for each channel. I want to plot these histograms on the same graph, where for instance, the histogram for the first (red) channel stretches on the x axis from 0 to 255, the histogram for...

Displaying surface with non-rectangular boundary

matlab,image-processing,plot,3d,surface
Refer to the attached image. I want to display the image in Matlab using the function surf(). However, I only want to display the region of the actual object without the background (the pale-green region surrounding the actual object which has 0 value). How to do that? I tried replacing...

Use lapply to plot data in a list and use names of list elements as plot titles [duplicate]

regex,r,plot
This question already has an answer here: Adding lists names as plot titles in lapply call in R 1 answer If I have the following list: comp.surv <- list(a = 1:4, b = c(1, 2, 4, 8), c = c(1, 3, 8, 27)) comp.surv # $a # [1] 1...

Plotting discrete count data as “staple” of points in ggplot2

r,plot,ggplot2
My goal is, to plot how often some bands have played at a festival. Basically, the plot should look like this: ggplot(plot.df2, aes(reorder(bands,count),count)) + geom_point() + coord_flip()+ theme_bw() But i would like to have a point for every time, the band has played there. This would be a "staple of...

How do I put multiple boxplots in the same graph in R?

r,plot,ggplot2,rstudio,boxplot
Sorry I don't have example code for this question. All I want to know is if it is possible to create multiple side-by-side boxplots in R representing different columns/variables within my data frame. Each boxplot would also only represent a single variable--I would like to set the y-scale to a...

How do you plot a graph consisting of extracted entries from a nested list?

plot,list-comprehension,python-3.4,nested-lists
I have a nested list such that; nested_list = [[4, 3, 0], [6, 8, 7], [3, 1, 8], [2, 1, 3], [9, 9, 3], ...] which has 100 entries. I need to plot a graph of all the first elements of each sub-list where Sub_List_1 = [4, 6, 3, 2,...

Plotting image and points on Matlab GUI via update function

image,matlab,user-interface,graph,plot
excuse my noobness, but this is my first post. i generated this gui in matlab, and i want to plot an image on one of the axis from an update function. i know in Matlab you can just do something like image(img) hold on plot(x1,z1) hold off but how can...

Plotting multivariate time-series data in R

r,graph,plot,ggplot2,time-series
My data looks like this: > head(Full.df) Date Month Week Year Count.S Count.G Count.W Count.F 1 2006-01-02 2006-01-01 2006-01-02 2006-01-01 0 7 9 6 2 2006-01-03 2006-01-01 2006-01-02 2006-01-01 0 13 12 4 3 2006-01-04 2006-01-01 2006-01-02 2006-01-01 0 13 15 4 4 2006-01-05 2006-01-01 2006-01-02 2006-01-01 0 20 6...

How to switch Matlab plot tick labels to scientific form?

matlab,plot
I have a semilogarithmic plot which works so far with semilogx. Now I would like to change the tick labels. Now it says 10^8 10^9 ... 10^13, but I would like to see 1e8, 1e9, ... 1e13 on the x-axis. How can I change that? Cheers Manuel...

Add a gap between the second and third series in a Highcharts column plot with four series displayed

javascript,plot,highcharts
I have a Highcharts column plot that shows four series. I would like series one and two to be touching each another (the two blue ones), then have a small gap, and then have series three and four touching each another (the orange ones). Can this be done? I haven't...

how can i plot a route map?

javascript,google-maps,plot
I am writing a simple application to plot multiple marker in the google map and connect it thought a path as it looks like a route . I can plot multiple marker . and search some article which plot the route map . but i can not plot it ....

seaborn: legend with background color

python,plot,legend,seaborn
The following question explains how to change the background color of a legend: matplotlib legend background color. However, if I use seaborn this does not work. Is there a way to do this? import matplotlib.pyplot as plt import numpy as np a = np.random.rand(10,1) plt.plot(a, label='label') legend = plt.legend() frame...

Add a segment of a regression line to a plot

r,plot
I have 4 regression lines and I want to have them in one plot. Here is my simple code: data = read.csv("TEST.csv", header = FALSE) plot(data$V1,data$V2) fit <- lm(data$V2~data$V1) abline(fit, col=1) data1 = read.csv("TEST1.csv", header = FALSE) fit1 <- lm(data1$V2~data1$V1) abline(fit1, col=2) data2 = read.csv("TEST2.csv", header = FALSE) fit2 <-...

draw the y-label on the top of y axis

r,plot,axis-labels
I want draw the ylab on the top of the y axis, which code can I use? Here is the example par(mar=c(4,6,4,4)) plot(rnorm(100), ylab="") mtext(side=2, text="Label", las=1, line=2) I want draw the ylabel at the top of y axis which red arrow indicated. ...

“Icon” (ISOTYPE) charts in R shiny with Javascript

javascript,r,plot,statistics,shiny
I'm working on a project to build several models for data analysis and reporting using R and the amazing Shiny framework for web development. I'm getting started with R and Shiny but I've had an amazing experience so far, yet, I'd like to get some help in case someone has...

Plotting multiple graphs in one page using loop

r,loops,plot
I am trying to plot multiple graphs on the same page. It works fine when I write the code one by one like this: old.par <- par(mfrow = c(3,4)) plot(na.omit(AUS.Yield), xlab = "Date", ylab = "log_return", main = "AUS.Yield") plot(na.omit(BRA.Yield), xlab = "Date", ylab = "log_return", main = "BRA.Yield") plot(na.omit(CAN.Yield),...

matlab plots as movie with legend

matlab,plot,legend,movie
i have a question regarding legend for movies. This is my code: fig = figure(); for i = 1: 70000 plot(signal1) hold on; plot([i,i],[-5,5]) plot(signal2,'r') hold off; title('\fontsize{14} my data'); legend('signal1','signal2'); axis tight; f(i) = getframe(fig); end The legend shows the same colors for the first two things I plot....

Assign same custom color to two lines coming from different data-frames but in the same plot

r,plot,ggplot2
I have the following plot, plotting data coming from two different data-frames: ggplot() + stat_summary( data = d0_400, aes(x=number, y=(1-value), shape=as.factor(0), size=1 ) , fun.y=mean, geom="line" ) + stat_summary( data = d0_400, aes(x=number, y=(1-value), shape=as.factor(0), size=4 ) , fun.y=mean, geom="point" ) + stat_summary( data = d1_400, aes(x=number, y=(1-value), shape=as.factor(1), size=1...

Python - matplotlib - PyQT: plot to QPixmap

python,matplotlib,plot,pyqt
I want to visualise matplotlibs colormaps (similar to http://matplotlib.org/examples/color/colormaps_reference.html) and use it as QPixmaps in PyQt widgets. The idea is to create the plots in matplotlib without actually showing it (or saving it to a file) and convert it to a QPixmap. The solution offered here (Python - matplotlib -...

R: ggplot2: Unable to plot points from a data.frame

r,plot,ggplot2
So I want to do a simple plot where the following x-coordinates should be plotted as points. This is what my data.frame looks like: gap_pos 1 50646312 2 50647076 3 50647511 4 50647512 5 50647513 6 50647546 Now I have tried to do it as simple as possible: gap_plot <-...

Adding date tick marks to a Matlab plot

matlab,plot,time-series
I have a plot of time series data, and I would like to replace the tick marks of the x-axis (automatically I have the number of the ordered observations) with the date when the value is observed. I would like to have a tick mark every 5 years for example....

How to make gnuplot to NOT plot multiple lines?

plot,scripting,gnuplot
I am plotting some data and I am getting multiple lines streaking across the plot. There should be one line, so I imagine that gnuplot is trying to fit the data and is joining points or something in a strange way. How can I get gnuplot to plot one like...

Customized back-to-back histogram in R

r,plot,histogram
Given this example of back to back histogram: set.seed (123) xvar <- round (rnorm (100, 54, 10), 0) xyvar <- round (rnorm (100, 54, 10), 0) myd <- data.frame (xvar, xyvar) valut <- as.numeric (cut(c(myd$xvar,myd$xyvar), 12)) myd$xwt <- valut[1:100] myd$xywt <- valut[101:200] xy.pop <- data.frame (table (myd$xywt)) xx.pop <- data.frame...

gnuplot highlighting points when with lines

plot,gnuplot,highlight
I have 4 points I would like to plot using gnuplot, but with lines. The problem is, I can't find how to highlight these 4 points on the drawn line. I would like for the plot to be a line through the points, but that these points are also clearly...

R: melting a data.frame to use in ggplot2 for multiple y-value plot

r,plot,ggplot2,melt
I would like to plot multiple Y-values against a time-variable. I don't have a complete data frame, as I didn't collect all the Y-values to start with. I believe I need to melt() the data frame before passing it to ggplot2, but that seems to fail because the "id" column...

Get margin line locations in log space

r,plot
In a previous question I asked how to get margin line locations in user coordinates. I received an excellent answer in the form of the line2user function. However, I cannot figure out how to modify the function to work when either the x or y axis is on a log...

SAS Gplot overlay line plots

plot,sas
I am trying to plot two sets of line graphs on the same chart: /* make data */ data test ; do i = 1 to 2 ; do x = 1 to 5 ; y = i*x ; z = 0.5*i*x ; output; end ; end ; run ;...

Python returns instance instead of array

python,numpy,matplotlib,plot,instance
The structure of my program is simple. I have two .py files, say file1.py and file2.py. file1 is UI, file2 is calculations. When a button is pressed, file1 sends the user input to file2 and file2 does calculations and then it is supposed to return an array to file1 so...

Plot: Add legend that overlay several Frames

r,graphics,graph,plot
How can we write a legend that overlay several frames? Using the xpd parameter, the legend can exit its frame but still cannot enter the next frame. par(mfrow=c(1,2)) plot(rnorm(120), rnorm(120)) legend(x = -0.1, y=0.1, legend = "Legend that covers both plots", text.col="red", cex=2, box.col="red", xpd=TRUE) plot(rnorm(120), rnorm(120)) One dummy solution...

Turn off scientific notation and offset globally

python,matplotlib,plot
I have been trying for several hours to globally turn off scientific notation and the offset in matplotlib. my attempt at a solution import matplotlib as mpl import matplotlib.pyplot as plt The documentation says: set the rcParam axes.formatter.useoffset=False to turn it off globally, or set a different formatter. mpl.rcParams.formatter.useoffset =...

Plot user transactions for every day of week

php,mysql,plot
In my DB there is Transaction table. This table contains information about user money transactions. My task is to generate two diagrams(graphs) showing transaction amount per day, and per month. Example of the diagram that I should implement is displayed on the image below: As you can see from the...

Plotting Probability Density Heatmap Over Time in R

r,plot,time-series,kriging
Let's say I have the output of a monte-carlo simulation of one variable over several different iterations (think millions). For each iteration, I have the values of the variable at each point in time (ranging from t=1 to t=365). I would like to produce the following plot: For each point...

Categorical scatter plot in Matlab

matlab,plot
How would you produce in Matlab a categorical scatter plot comparable to this? The above chart was generated in R, in response to this question....

How to set number of ticks along X axis in matlab?

matlab,plot,matlab-figure,figure
I'm having trouble setting the appropriate number of ticks along the Xaxis in Matlab. As you can see below, I set the number to 2 in ha.XTicksNumber=2, yet it still plots 10. nSites = 2; ha = tight_subplot(nSites,1,[.01 .01],[.1 .1],[.1 .1]); display(ha); for ii = 1:nSites; axes(ha(ii)); xData=linspace(1,100,90); plot(xData); if...

Plotting in R 3.1.2 [closed]

r,plot,ggplot2,ggmap
I have records of data by account (say unique 400 records). Each record has three different indications indicated premium. For each record, I am concerned with how the indications compare to each other. In some cases, the indications may be all relatively in line, while in other the 3 indications...

Interactive pcolor in python

python-2.7,matplotlib,plot,interactive
I have two numpy arrays of sizes (Number_of_time_steps, N1, N2). Each one represents velocities in a plane of size N1xN2 for Number_of_time_steps which is 12,000 in my case. These two arrays come from two fluid dynamics simulations in which a point is slightly perturbed at time 0 and I want...

R Shiny - set reactive width of a plot output

plot,shiny,reactive-programming,weight
I am filtering a tbale and a heat-map simultaneously. During filtering, the width of the table is changing such that width of particular columns remains the same. Width of the heat-map remains the same during filtering. I want the heat-map to change its weight in the same way as the...

Plotting random signal on circle

matlab,plot,signals,circle
I have some random signal (for example sin signal) with the time scale. t=0:0.1:2*pi y=sin(t) plot(t,y) Now I want to draw this signal on this circle. So the time vector actually becomes an envelope of the circle. Envelope of the circle represents "y = 0" in cartesian coordinate system. Here...

Logical grouping of arbitrary number of plots in R

r,plot,par
I have n plots that I want to display in a grid in a single image in R. Using par I can specify beforehand the number of rows and columns to divide the plot. For example, for n = 4, it makes most sense to organize 4 plots in a...

How to put several formulas outside of a plot (top) using ggplot2?

r,plot,ggplot2
I have problems using annotation_custom. Here is the dataset: DOSE PROD pH 1 0 CL 4.3550 2 0 CO 4.3250 3 0 CZ 4.1475 4 0 PF 4.2300 5 0 RP 4.1225 6 25 CL 4.3420 7 25 CO 4.3520 8 25 CZ 4.7840 9 25 PF 4.2640 10 25...

How to add shading through all subplot

python,matplotlib,plot
I have a question about add shading in my figure. I need to shading all subplot like the picture below, how to do it in Python?

Plot multiple frames of different size on the same window

r,graphics,graph,plot
Consider this example: par(mfrow=c(2,3)) frame() image(matrix(1:100, nrow=100), main="my wide plot", axes=FALSE) frame() plot(rnorm(120), rnorm(120), main="plot 1") plot(dpois(0:20, lambda=6), type="b", main="plot 2") x = rnorm(100) y = x+runif(100, 10, 12) plot(x=x, y=y, , main="plot 3") How can I do to make my first graph (image(...) titled my wide plot) to occupy...

How to add plot labels of different axes to the same legend in Python?

python,matplotlib,plot,axes
I am trying to plot two curves on two y-axes as shown in figure. The red plot (pressure) the primary axis and green (needle lift) the secondary axis. And I am trying to add the plot labels to the same legend. But I cannot add them to the same legend....

Python: matplotlib - probability mass function as histogram

python,python-2.7,matplotlib,plot,histogram
I want to draw a histogram and a line plot at the same graph. However, to do that I need to have my histogram as a probability mass function, so I want to have on the y-axis a probability values. However, I don't know how to do that, because using...

Hierarchy in matplotlib

python,matplotlib,plot
According to this article, everything in matplotlib is organized in a hierarchy. At the top of the hierarchy is the matplotlib "state-machine environment" which is provided by the matplotlib.pyplot module. At this level, simple functions are used to add plot elements (lines, images, text, etc.) to the current axes in...

Matplotlib/Genfromtxt: Multiple plots against time, skipping missing data points, from .csv

python,csv,matplotlib,plot,genfromtxt
I've been able to import and plot multiple columns of data against the same x axis (time) with legends, from csv files using genfromtxt as shown in this link: Matplotlib: Import and plot multiple time series with legends direct from .csv The above simple example works fine if all cells...

Flot Graph inconstencies with axis and tooltips?

javascript,jquery,plot,flot
I am working on an application where I am trying to plot a similar graph to what is plotted at Open Weather. I am using the FlotJS library to query their API and plot the graphs. Here is my code. I apologize for the verbosity. /* * RUN PAGE GRAPHS...

Set label on group multiplot in gnuplot

linux,graph,plot,gnuplot
Im plotting one picture with 4 different graphs using gnuplot. Labels for their x and y axes have the same meaning. If Im plotting it like this: set multiplot layout 2,2 rowsfirst set xlabel "x" set ylabel "y" set title offset -3,-3 set xrange [20:70] set yrange [0:15000] set title...

Set categorical axis labels with scales “free” ggplot2

r,plot,ggplot2,facet
I am trying to set the labels on a categorical axis within a faceted plot using the ggplot2 package (1.0.1) in R (3.1.1) with scales="free". If I plot without manually setting the axis tick labels they appear correctly (first plot), but when I try to set the labels (second plot)...

Racket: Graphing a parabola with elements from a list

list,function,plot,racket
I have created the following expression which I would like to graph parabolas based on the last two elements in a list. It looks like this: #lang racket (require plot) (define list-sqr-graph (lambda (lst) (cond [(null? lst) (plot (function sqr 0 0))] [(<= (car lst) 0) (list-sqr-graph (cdr lst))] [(not...

grep part of dataframe and use as title in plot

r,plot,grep
how do I get the name of a dataframe say mydf.mtcars<-mtcars and grep everything after the . i.e. mtcars and then use this as the title in a plot? It would be the equivalent of doing plot(mydf.mtcars,main="mydf") Thanks...

Matlab: discontinuous plot

matlab,plot
I want to make a plot that discontinues at one point using Matlab. This is what the plot looks like using scatter: However, I would like to the plot to be a smooth curve but not scattered dots. If I use plot, it would give me: I don't want the...

Why does plot behave differently for same but scaled data?

r,plot
Why does plot behave differently for different data, and how do you control it? My specific example today is getting different output with scaled and non-scaled data. For example fit <- kmeans(mydata, 4) plot(mydata, col = fit$cluster) returns a nice 4x4 scatter matrix plot (mydata is 486x4) but mydata <-...

Object-oriented access to fill_between shaded region in matplotlib

python,matplotlib,plot,fill
I'm trying to get access to the shaded region of a matplotlib plot, so that I can remove it without doing plt.cla() [since cla() clears the whole axis including axis label too] If I were plotting I line, I could do: import matplotlib.pyplot as plt ax = plt.gca() ax.plot(x,y) ax.set_xlabel('My...

making a choropleth from SpatialPolygonsDataFrame- ggplot vs ggplot2 vs plot?

r,plot,ggplot2
I have a shapefile, specifically, a SpatialPolygonsDataFrame, called cdtract. that contains one variable for each district called varcount. varcount is either "NA" or 1. When I do plot(cdtract) ...I see the map printed out but I don't see the tracts that are '1' in varcount marked any differently from those...

Creating plots from 2-D values generated in a for loop in Python

python,for-loop,matplotlib,plot
I'm creating a trail of the (x,y) co-ordinates generated in a for-loop. But the plot pops up and it's blank. Can someone help the noob out? import random import math import matplotlib.pyplot as pl x = 0 y = 0 dx = 0 dy = 0 v = 2 n=100...

Python - Superimpose 2 plots in subplot with matplotlib by using alpha channel

python,matplotlib,plot,alpha
I would like to superimpose 2 plots in one plot by using "alpha channel". I try to get the contour of the right figure on plot of left: My code is : plt.close() fig, axes = plt.subplots(nrows=1, ncols=3) plt.tight_layout(pad=0.05, w_pad=0.001, h_pad=2.0) ax1 = plt.subplot(131) # creates first axis ax1.set_xticks([0,2000,500,1000,1500]) ax1.set_yticks([0,2000,500,1000,1500])...

Read One Input File and plot multiple

python,numpy,matplotlib,graph,plot
I am trying to read one input file of below format. Where Col[1] is x axis and Col[2] is y axis and col[3] is some name. I need to plot multiple line graphs for separate names of col[3]. Eg: Name sd with x,y values will have one line graph and...

Matplotlib: Plot the result of an SQL query

python,sql,matplotlib,plot
from sqlalchemy import create_engine import _mssql from matplotlib import pyplot as plt engine = create_engine('mssql+pymssql://**:****@127.0.0.1:1433/AffectV_Test') connection = engine.connect() result = connection.execute('SELECT Campaign_id, SUM(Count) AS Total_Count FROM Impressions GROUP BY Campaign_id') for row in result: print row connection.close() The above code generates an array: (54ca686d0189607081dbda85', 4174469) (551c21150189601fb08b6b64', 182) (552391ee0189601fb08b6b73', 237304) (5469f3ec0189606b1b25bcc0',...

R stacked area chart - ignore NA and retain full x-axis

r,plot,charts
i've decadal time series from 1700 to 1900 (21 time slices) and for each decade i've got 7 categories that represent a quantity; see here As you can see, only 5 of the decades actually have data. I can plot a nice little stacked area chart in R, with the...

How to plot function with parameter in R

r,plot
I would like to plot a function several times, each time changing a parameter (a constant) in the function. How can i do this? fun1 <- function(x, b) abs(x^2 - b^2) plot(fun1(b=0.1),-1, 1) plot(fun1(b=0.2),-1, 1, add=TRUE) ...

Filling the area between three curves in MatLab with Bold Plot

matlab,plot,matlab-figure
I am trying to make a graph similar to the one below: I have the plots for the lower bound of the graph, the median (bold line) and the upper bound. I tried working around with fill but it seems to create weird filled polygons. Also, how can I make...

Matplotlib Line2D unexpected behavior

python,matplotlib,plot
This is a minimum working example. I expect the following code to draw a line from (-2.33,10) to (4.33,-10), but the line I get is totally different. What is wrong? import matplotlib.pyplot as plt import matplotlib fig = plt.figure() ax = fig.add_subplot(111) ax.axis((-10,10,-10,10)) line = matplotlib.lines.Line2D((-2.33,10.0),(4.33,-10.0)) ax.add_line(line) plt.show() ...

How to change factors to be grouped in a barplot

r,plot
I tried to do a barplot to a factorial anova dataset by using R. However, R automatically plots each bar corresponds to different columns of my dataset matrix. How can I do a barplot with each bar corresponds to different rows instead? High demand Low demand None Difficult 934 739...

Shift Plot Data Along X Axis Matlab

matlab,plot,axis,shift
I cannot get Matlab to plot a a second time series to specific points along the x axis. My data are two time series. Time series A is a 5 X 1 and time series B is a 7 X 1. I need A to plot on xticklabels 1-5. Then,...

matplotlib mean interval plot

python,pandas,matplotlib,plot
I'm transitioning from R to python, and was looking to plot the mean line of a two variables. It is the plot of the x variable is split into intervals for the x axis, and mean of the y variable for the y axis. For example, if I have 1000...

term frequency over time: how to plot +200 graphs in one plot with Python/pandas/matplotlib?

python,matplotlib,plot,nlp
I am conducting a textual content analysis of several web blogs, and now focusing on finding emerging trends. In order to do so for one blog, I coded a multi-step process: looping over all the posts, finding the top 5 keywords in each post adding them to a list, if...

Animate through multiple 2D Matlab plots

matlab,plot
I have multiple 2D line plots in Matlab (they represent some wave moving through space). Each plot represents the wave at some time t. I want to animate through these plots (i.e. show the first plot for a fraction of a second, then show the next one, and the next,...

Octave plot different colour for every point

plot,octave
I am having a specific problem. Firstly I am using octave. I have a dataset where every row is of the following format: datarow = [ x, y, z, colourIndex]; The length of the dataset is irrelevant, but suppose it is 10. I want to be able to plot the...

MATLAB: Trying to add shared xlabel,ylabel in 3x2 subplot

matlab,plot,graphing
As the title says, what I am pretty to do is fairly straight forwards. I have a grid of m=3,n=2 subplots. They represent graphs of 6 different experiments measuring the same parameters. I would like to have a single x label and a single y label on the border of...

Align bars in ciplot

plot,stata
I'm working with the ciplot graphing module for Stata and am encountering a problem with the alignment of bars when I use the by() option. Here's a trivial example demonstrating the issue: webuse citytemp, clear ciplot heatdd cooldd, by(region) horizontal recast(conn) So, the graph shows means and confidence intervals for...

Putting space between bars using bar function

matlab,plot,bar-chart
I am try to plot 16 bars, 8 of these belong to one group. I want to give this group the red color, the other 8 belong to another group which is given the blue color. I would like to arrange the bar in pairs, each pair containing one from...

Matlab - plot bar and line graph on the same y axis

matlab,plot,line
I'm trying to plot a line graph and a bar graph on the same y-axis: figure; plotyy(Pert, Rfootvel(:,i+1), Pert, 0,'bar','plot'); hold(ax(1), 'on'); legend('Pert 1-8', 'Base'); ylim(ax(2), [0 1]); title(['The avg pert velocity of the first step vs the avg base velocity, PP' num2str(j)]); Unfortunately, setting the second y-axis limit like...

How to set x-axis with decreasing power values in equal sizes

r,plot,ggplot2,cdf
Currently I am doing some cumulative distribution plot using R and I tried to set x-axis with decreasing power values (such as 10000,1000,100,10,1) in equal sizes but I failed: n<-ceiling(max(test)) qplot(1:n, ecdf(test)(1:n), geom="point",xlab="check-ins", ylab="Pr(X>=x)")+ geom_step() +scale_x_reverse(breaks=c(10000,1000,100,10,1)) +scale_shape_manual(values=c(15,19)) It seems that the output has large interval for 10000, then all the...

Plot SpatialPoints “ylim” behaviour incomprehensible

r,plot,sp
I'm trying to plot a SpatialPoints object using the generic function from the Package graphics. The extent of the plot should be exactly the size of the outermost datapoints. Here's a simple example where the ratio of delta x over delta y (outermost values) is 1: library(sp) xydata <- as.matrix(cbind(c(1,1,2,2,1.5),c(1,2,2,1,1.5)))...

R histogram - standard deviation of multiple density lines

r,plot,histogram
I plotted a histogram below that is the mean density of multiple vectors. The frequency distribution of each vector is shown by the grey lines overlaid on the histogram. Rather than plotting each of these lines, is there a way to plot the standard deviation above and below the mean...

Clustering network nodes by attributes

r,graph,plot,igraph,edges
I have a data.frame similar to d as follows. d <- structure(list(ID = c("KP1009", "GP3040", "KP1757", "GP2243", "KP682", "KP1789", "KP1933", "KP1662", "KP1718", "GP3339", "GP4007", "GP3398", "GP6720", "KP808", "KP1154", "KP748", "GP4263", "GP1132", "GP5881", "GP6291", "KP1004", "KP1998", "GP4123", "GP5930", "KP1070", "KP905", "KP579", "KP1100", "KP587", "GP913", "GP4864", "KP1513", "GP5979", "KP730", "KP1412", "KP615", "KP1315",...

gnuplot - How can I count the number of entries in a csv file column?

csv,plot,gnuplot,function-fitting
I have a gnuplot code which includes a function fitting routine. This routine is slow when a large number of data points must be fitted. The number of data points in my input file is variable depending on the parameters of some simulations I am running. I wish to fit...

Python: Using panda to import csv. Trying to plot a column but gives me an error saying “no numerical data to plot”

python,csv,pandas,plot
I'm trying to read following csv-file with panda and plot a column of it: data type,approved mining area,mined area,coal content,earth rate,coal rate,waste ratio unit,ha,ha,Mt,Mm3/a,Mt/a, Garzweiler,11400,3096,1246,140,37.5,4.4 Hambach,8500,4224,1500,275,40,5.2 Inden,4500,1655,358,87.5,22.5,3.6 which gives me the following (only a part so it fits here): data type approved mining area mined area coal content earth rate...

R: Plot Density Graph for data in tables with respect to Labels in tables

r,plot,ggplot2
I got a data in table form which look like this in R: V1 V2 1 19 -1539 2 7 -1507 3 3 -1446 4 7 -1427 5 8 -1401 6 2 -422 7 22 4178 8 5 4277 9 10 4303 10 18 4431 ....200 million more lines to...

R: Multible line in a plot using curveid

r,plot
I'm researcher and not a programmer. I have often used the drc package, to analyze data. There you can define a curveid and it will plot multiple lines in one plot. I need the same thing just for the normal plot, but obviously is my knowledge to little to do...

How plot a messy random-size circles in MATLAB? [closed]

matlab,plot,matlab-figure
I am going to draw a figure such as below picture in the MATLAB R2014b: . This figure consists of many circles with different (random) colors and random sizes. How is it possible to plot such this figure in MATLAB R2014b?...

How to rotate an image R raster

r,plot,rotation,raster
I have code below which saves an image to my pc. I would like to rotate that image by 45,90 and 135 degrees around its center (or bottom left hand corner) and then save as 3 different images. How could I do that? library(raster) r1 <- brick(system.file("external/rlogo.grd", package="raster")) x <-...

how to create a 3D height map in python

python,matplotlib,plot,3d,surface
I have a 2D array Z that stores the height at that element's position. Other than using the method here in which I need to create array X and Y with the same size as Z, are there any simpler methods to create a 3D height map? The 3D surface...

using pcolor to plot 2d array with different cell size in matlab

matlab,multidimensional-array,plot,size,cell
i have a domain of interest and this domain will be converted onto finite difference grid with cells (rows,columns) a 2-D array (cond) contains the conductivity values assigned to each cell in the desired domain when i use the pcolor command in matlab pcolor(cond); shading flat the output figure consider...

rCharts doesn't render the plot in shiny app

r,plot,shiny,rcharts
I am using following simple shiny app code snippet to plot the output in the main pannel. But it doesn't render the plot as expected. It shows nothing in the browser. But When i run only the mPlot portion, it displays the plot in RStudio correctly with all interactions. ui.R...

Arrange line in front of bars in Matplotlib plot with double y axes

python,matplotlib,plot
I want to plot a graph with two y axes, and I want the left y axis to show a line according to which the x axis is sorted, and the right y axis to show bars. My problem is that the secondary y axis hides the first y axis,...

How to add labels on each line and add 2nd y-axes to the right side of the 'loglog' plot?

matlab,plot,matlab-figure,iso,loglog
Recently I am trying to implement the ISO classification for the roadway assessment. Please refer to the paper The use of vehicle acceleration measurements to estimate road roughness. But I bumped into some questions about plotting the ISO classification graph. The code is shown as follows: %% generate ISO Clasification...

Display value of Y axis inside GUI plot

matlab,user-interface,plot
I have program code in matlab with GUI. I have there some axes object called "axes1" - there my plot is displayed (simple plot of x, y values). I want that after point on line there shows value of Y axis in that point. And best if it would display...

Align axis ticks with bins in a lattice histogram

r,plot,lattice
I plotted a histogram using Lattice histogram(~Time |factor(Bila), data=flexi2, xlim= c(5, 15), ylim=c(0, 57), scales=list(x=list(at=seq(5,15,1))), xlab="Time", subset=(Bila%in% c(""))) The bins I get do not match the exact hours, whereas I would like the bin to start at the exact hour, for example, 6,7 etc. I use lattice since I want...

Shade indicator variables R

r,plot,rect
please help: I want to shade a time-series figure in R's plot for all values where an indicator variable, z == 1. Here follows a code which generates a similar scenario that I am looking at: x <-runif(100, 5.0, 7.5) y <-runif(100, 1, 10) z = as.numeric(y >= 5) date...

How colorize Circles in a plot in MATLAB?

matlab,graphics,plot,matlab-figure
I have a MATLAB code as follows: MinVal = -1; MaxVal = 1; MaxRadius = 0.5; nCircles = 5; Dimension = 2; Circles = zeros(nCircles, Dimension); Radius = zeros(nCircles, 1); for i = 1 : nCircles Circles(i,:) = unifrnd(MinVal, MaxVal, [1, Dimension]); Radius(i) = unifrnd(0, MaxRadius, 1); end t =...

MATLAB - How to merge figure sections vertically

matlab,plot
I want to display three figures in a figure window. Assuming that I divide 2x2 regions. subplot(2,2,1) ---------+----------- | R1 | R2 | ---------+----------- | R3 | R4 | ---------+----------- I want to show a figure merging R1 and R3 ant other two in R2 and R4 I can display...

Matplotlib: How to force integer tick labels?

python,matplotlib,plot
My python script uses matplotlib to plot a 2D "heat map" of an x, y, z dataset. My x- and y-values represent amino acid residues in a protein and can therefore only be integers. When I zoom into the plot, it looks like this: As I said, float values on...

How to plot colors on CIE 1931 Color Space in Matlab?

matlab,plot,colors,scatter-plot,color-space
I'm trying to plot few color values (co-ordinates) on the already plotted CIE 1931 color space. I've derived the XYZ color values which I want to plot, denoted as [X, Y, Z]- [50, 57, 10] [36, 43, 15] [28, 36, 8] [25, 32, 14] I using this function which plots...

Matplotlib heatmap: Image rotated when heatmap plot over it

python,matplotlib,plot,google-visualization,heatmap
I am trying to plot a heatmap on top of an image. What I did: import matplotlib.pyplot as plt import numpy as np import numpy.random import urllib #downloading an example image urllib.urlretrieve("http://tekeye.biz/wp-content/uploads/2013/01/small_playing_cards.png", "/tmp/cards.png") #reading and plotting the image im = plt.imread('/tmp/cards.png') implot = plt.imshow(im) #generating random data for the histogram...

Plotting two different arrays of different lengths

python,numpy,matplotlib,plot
I have two arrays. One is the raw signal of length (1000, ) and the other one is the smooth signal of length (100,). I want to visually represent how the smooth signal represents the raw signal. Since these arrays are of different length, I am not able to plot...