Questions tagged [plot]

13421 questions
1

votes
1

answer
404

Views

How to plot a subset of forecast in R?

I have a simple R script to create a forecast based on a file. Data has been recorded since 2014 but I am having trouble trying to accomplish below two goals: Plot only a subset of the forecast information (starting on 11/2017 onwards). Include month and year in a specific format (i.e. Jun 17). Here...
nsoria
1

votes
2

answer
286

Views

Plot all columns (number is not predefined) of xts object on one chart

How can I write R code that will take all columns from a single xts object and plot them on a single chart? My xts object looks like screenshot below and I don't know while writing a code what will be the number of columns there: screenshot of xts object I want R to take each of the columns and plot...
Egor_RU
1

votes
1

answer
299

Views

R/SparkR on Apache Zeppelin: how to set the plot size?

I run a SparkR notebook within Apache Zeppelin successfully. However, when I create plots (standard R plots, not ggplot), I wanna control the size of the figure, i.e. width and height. Any idea? Btw, I use livy, so my snippets look like: %livy2.sparkr x = rnorm(10) plot(x)
lambruscoAcido
1

votes
1

answer
229

Views

Plotting spheres around given coordinates in 3D in Matlab

I am working on model of an object sliding on some rough surface consisting of spheres with a small random variance in position. In the graphics I want the spheres to be of a given radius, however when using scatter3 this wont work, the sizes of the circles change when I zoom in or out. I could easi...
Slobodan
1

votes
1

answer
182

Views

how to make a simple raster plot with one or more event traces

Can anyone recommend a simple way to make a raster plot of events in Matlab? Rather than giving me a binary read out of all the time points in a range, the recording data I generate gives me the timepoints that specific events occur at , but not the timepoints in between. Because of this, I end up w...
MatlabDumbDumb
1

votes
1

answer
285

Views

R plotly flat surface in 3d scatterplot

I am trying to add a flat surface to this plot (Excuse the size, if I make it bigger the file is too large). The surface should be parallel to the ground with the third dimension equal zero. It should go through the red points. Code to reproduce: n.cases
Steinroe
1

votes
1

answer
827

Views

Create and plot a piecewise function in Octave

So I want to plot this function enter image description here for -1 First I created the piecewise function function x = pieceWise(t) if t >= 0 & t
Tanaka
1

votes
2

answer
236

Views

ChartJs Force scatter plot to be square shaped

I am trying to create a scatter plot where XAxes and YAxes is the same scale and size. The plot will become a square with identical Axes. Therefore if the data be {x:0, y:0}, {x:100, y:100} it draws a diagonal (45 degrees) line. I am plotting A vs. B and the rectangular shape of the plot is confus...
JooJoo1020
1

votes
0

answer
105

Views

Show specific plane (XY) in plotly 3D Scatterplot in R

With showgrid = TRUE for x-axis and y-axis, is there any way to get rid of the VERTICAL lines extending from the x and y-axis so that there is a single plane showing? library(plotly) itemName = c('Alpha', 'Bravo', 'Charley', 'Delta', 'Echo', 'Foxtrot') security = c(0.8583241, 0.7516891, 0.5390520,...
craab
1

votes
1

answer
53

Views

generate series of plots with pandas dataframe

I have to generate a series of scatter plots (roughly 100 in total). I have created an example to illustrate the problem. First do an import. import pandas as pd Create a pandas dataframe. # Create dataframe data = {'name': ['Jason', 'Jason', 'Tina', 'Tina', 'Tina', 'Jason', 'Tina'], 'report_valu...
Marnix
1

votes
1

answer
102

Views

Legend in R plot that has kernel density, normal density and a histogram?

I am currently a beginner in R and had a question on how to insert a legend for three plots I am working on. I am working with the built-in dataset on R called iris. I have something down for what I think should work in order for the legend to appear, but that is not the case, as only the plots appe...
Shilpa Kancharla
1

votes
0

answer
59

Views

Running multiple python scripts to plot data in parallel

I'm looking for some advice as to how to organise a python project. I have a directory ./scripts containing several python scripts as below: . ├── plot.py ├── __init__.py └── scripts └── __init__.py └── sinx_1.py └── sinx_2.py └── sinx_3.py Each of these scr...
1

votes
0

answer
41

Views

R plots' axis limits reset in Markdown

The plot rendered in R Markdown doesn't use the axis limits I specified in the code. plot(ansX1, ansY1, xlim=c(2,20), ylim=c(2,15)) abline(lm(ansY1 ~ ansX1)) Running this in RStudio generates a plot with the correct axis limits. When rendered in R Markdown, the x-axis limits are [-10,30]. Why does...
Jonathan Brouwer
1

votes
1

answer
114

Views

plot multiple XTS timeseries by day only

i have a question with plotting (time series) in R and I hope someone can give me some suggestions: I have an R project (latest version) where i want to compare the river outflow with precipitation and other climate factors. This I want to do by seasons and/or monthes. However, when i want to plot m...
Sascha
1

votes
1

answer
646

Views

Plot Multicolored Time Series Plot based on Conditional in Python [duplicate]

This question already has an answer here: How to plot multi-color line if x-axis is date time index of pandas 2 answers I have a pandas Financial timeseries DataFrame with two columns and one datetime index. TOTAL.PAPRPNT.M Label 1973-03-01 25504.000 3 1973-04-01 25662.000...
Danish A. Alvi
1

votes
0

answer
266

Views

Gnuplot: Violin plot with data from file

I created a script to plot the columns of a dataset using violin plots to show the distribution of the data points starting from the Gnuplot Demo Scripts. However, I can't solve the following error: 'violinplot.gnu', line 27: all points y value undefined! Does anyone have any idea? The script: rese...
Nicola
1

votes
1

answer
515

Views

Data from two data frames in one plot (R)

I've got two data frames in R, both of the same structure - with columns named: Year, Age, Gender and Value1. What I'd like to do, is to plot (as points) Value1 (on Y axis) against Year (on X axis), for a particular gender and age. The plot should consists of points from both data frames (with legen...
CrueL WhoAmI
1

votes
0

answer
94

Views

Vertically aligning multiple timeseries plots

I've got measurements of several different quantities made during the same range of time. How can I plot them all in the same window, so they're all vertically aligned—that is, so that for any given time t, all the data points for that time have the same x (horizontal) coordinate in the window?...
Ben Kovitz
1

votes
0

answer
62

Views

How to generate the diagnostic regression plots of rbase to an object that is not a lm class?

I would like to generate the regression diagnostic plots from the base of r, to a 'non-lm' object. ## Generate reg. with lm function set.seed(2458840) x
Mario GS
1

votes
1

answer
41

Views

ILNumerics hide PlotCube

I have a scene with two different PlotCubes, wich have to be displayed individually. What is the best procedure to hide and show the PlotCubes. I have tried with remove, but this seems to alter the PlotCube-objects. The code-lines are: IlPanel1.Scene.add(PlotCube1) IlPanel1.Scene.add(PlotCube2)...
ISE
1

votes
0

answer
213

Views

Rasterize plot when using PDF output device

Hello everybody out there using R, When putting multiple plots with thousands of data points into a single PDF file, this file can get huge and take a long time to open. The following post describes exactly the same problem in Matplotlib, as well as a nice fix for it: Matplotlib: multipage PDF with...
NicolasBourbaki
1

votes
1

answer
109

Views

ggplot2 plotting time series with multiple lm

I am trying to fit a geom_smooth to multiple phases in a time series where the plot has two variables, but I only want one of the variables smoothed or a way to have a separate geom_smooth() for each variable factor. The example data frame (df) is at the bottom of this thread - so run first for the...
Lmm
1

votes
1

answer
155

Views

c3 charts dynamic bubble size in scatter plot, wrong index

I'm trying to make a chart like with c3.js. For the bubble size I create an array for each 'continent' holding the population as a factor to increase the bubble size. Also the country name is stored in the same manner. When adding the data points to the chart as well as when adding the bubble sizes...
haferblues
1

votes
1

answer
53

Views

Plot undetermined number of plots using ggplot2

I am trying to plot the contents of a Principal Component Analysis using ggplot2. I would like to generate a single pdf with all plots in it with a user-specified number of principal components to show (so if user says 3, it would plot PC 1 vs 2, 1 vs 3 and 2 vs 3). I've looked into gridextra and bu...
Jorge Kageyama
1

votes
1

answer
160

Views

Multi line plot subtitle with scientific names in ggplot2

I am having trouble making the subtitle for my ggplot2 graph. I tried the answer here but it is only applicable if you have one scientific name. In my case, I have two scientific names that I wanted to include in the plot title. This is the subtitle that I want to include: 'High quantity of Bullet t...
turonlapis
1

votes
0

answer
453

Views

R markdown word output, put kable and figure side by side

Is there a way to put a kable (from the knitr package) and a plot side by side in the output (word output)? I have this in my code: ```{r, echo=FALSE} res$actzoneBar kable(res$actzone) Where the first one is a plot, and the second one a table with just 2 columns. So they would perfectly fit side by...
pk_22
1

votes
0

answer
191

Views

how to extract modularity scores for each partition in a walktrap community?

I am new to Community Detection and to make things harder I am also a beginner in R - please keep this in mind when you kindly answer. I am happy to add my data to this post if anyone could tell me how to achieve that please? First Problem I created a directed graph with 2198 nodes and 1380771 edges...
Thea
1

votes
1

answer
260

Views
1

votes
0

answer
193

Views

Plotting Octave Plots in RMarkdown

I am trying to knit Octave code in Rmarkdown , it works fine for printing and text based output , but not knitting the plots to html. ```{octave,engine.path='/usr/local/bin/octave/',results='asis',echo= TRUE} x = -10:0.1:10; # Create an evenly-spaced vector from -10..10 y = sin (x); # y is also...
Siddharth Bhatia
1

votes
0

answer
235

Views

Propensity score distribution using mirrored histograms in R

I want to create a mirrored histogram as seen in the sample chart below. A brief description: x axis is a continuous variable (propensity score, goes from 0 to 1) and y axis is count of individuals. The upper portion needs to show distribution of propensity score among treated and the lower portion,...
Adima
1

votes
2

answer
1.3k

Views

Correlation Matrix labels in Python

I'm using Python3. The top of my matrix is a problem, all the labels are overlapping so you can't read them. How do I fix this? Here is my code: import matplotlib.pyplot as plt import pandas import numpy budget_adj revenue_adj mov_data = ['popularity', 'budget', 'revenue', 'runtime', 'vote_averag...
EP31121PJ
1

votes
1

answer
136

Views

Hand gesture recognition using contour distance - Matlab

Based on a previous work (https://www.mathworks.com/matlabcentral/answers/144559-centroid-contour-for-a-binary-image-containing-multiple-objects) I am trying to plot the contour distance using hand gesture images located in http://cs.mcgill.ca/~pcrane/ Unfortunately, it seems that my plot are not id...
AsiJapan
1

votes
2

answer
1.1k

Views

Multiple Plots on the same page in R

I am trying to plot my two figures on the same page in R. Two plots are: Scatter and bat plot Used: par(mfrow=c(2,1)) p s where p is the bar plot and s is the scatter plot. When I used the command: first p plot shows and at the end only s-- scatter plot is shown. I know both the plots are there bu...
Bandana
1

votes
0

answer
77

Views

R: How to plot complex graphs in a loop quickly?

My first question here. I would like to plot three layers of colors in a loop and this is my code: matx
Norman
1

votes
1

answer
237

Views

for loop to plot the top n features importance in bokeh in python without explicitly typing the column names

I want to plot the top n features in RandomForestClassifier() in bokeh without specifying the column name explicitly in the y variable. So firstly, instead of typing the column name in variable y, it can take the column name and value directly from the top feature of the randomclassifier. y = df['n...
1

votes
2

answer
48

Views

Labeling x and y axes from imported data in R ggplot2

I have two sets of imported data I want plotted on the same graph: Set1 1 foo 50 2 bar 30 3 spa 70 Set2 1 foo 0.06 2 bar 0.001 3 spa 0.5 I want the set1 numbers plotted along the x axis (so, ranging from 0 to 100) and the set2 numbers plotted along the y (ranging from 0 to 1), with foo, bar, a...
Liquidity
1

votes
0

answer
29

Views

How can I align a photo with a plot in R?

I want to plot in R several panels with data measured along a sediment core (see image below). Next to the plots, I want to add a photo of that sediment core, aligned to the exact y coordinates as the plots (to be able to identify if a certain layer in the photo corresponds to a peak in some element...
Jordi Pagès
1

votes
1

answer
31

Views

Label a point when the x-axis is time/date

my data.dat looks like this 2018-01-15, 3268 2018-02-07, 3783 2018-02-08, 7569 And the relevant parts of my plot.plt looks like this set timefmt '%Y-%m-%d' set xdata time set format x '%b/%d' What I am trying to do is plot the data and put a label (with the text 'label') on a point thats 2018-02-28...
Fredrik
1

votes
1

answer
45

Views

Iterate with a button to a certain value in the Bokeh graph

The following code creates the following graph from bokeh.plotting import figure from bokeh.io import show, output_notebook from bokeh.models import Button, CustomJS from bokeh.layouts import row from random import random p = figure(x_range=(0, 10)) p.line(list(range(1000)), [random() for _ in ra...

View additional questions