Questions tagged [plot]

13421 questions
1

votes
2

answer
241

Views

Place xticks and yticks in the pixel center on imshow plot

I am working with matplotlib to plot a heat map with some information and I want to move the xticks and the yticks to the center. I have searched in stackoverflow for previous questions but I couldn't reach one suitable for the problem. I attach my code and the image that I get: import matplotlib.p...
A.Piquer
0

votes
0

answer
3

Views

How to set the size of the figures the same for my paper in Matlab?

I am writing a paper and it includes several figures. I wanna set the size of all figures the same in the paper since it's visually better. How can I do that? I thought it would be better to plot a figure first, and then get the size and position using command pos = get(gcf, 'Position'), and set the...
user78333
1

votes
1

answer
18

Views

How to change into italic style one letter in R plot without adding a space

I have almost done what I need that is basically having 'q' and 'Å' in italic in the x-axis label. However, I want to avoid the space before and after the 'Å'... It is probably a silly question but I have been trying to remove the '~' and something else without success. Where am I wrong? Basically...
Danilo
1

votes
2

answer
28

Views

Multiple Pen's Parade Graphs on the same Plot

I'm doing stochastic dominance analysis with diferent income distributions using Pen's Parade. I can plot a single Pen's Parade using Pen function from ineq package, but I need a visual comparison and I want multiple lines in the same image. I don't know how extract values from the function, so I ca...
fcochaux
0

votes
0

answer
2

Views

How to plot data from a csv file with 7 columns and 20001 rows?

I have instruments that sample data a .00025 (quarter mil) rate. I typically record 10-20 seconds of data which gives me 40K-80K lines and 7 columns. I need to plot some of that data in wave form to illustrate displacement amongst other things. Need direction new to this MATLAB/Octave world. Examp...
Alexander Rivas
0

votes
1

answer
24

Views

Visualise differences between factor levels using ggplot

I have a plot in my mind that I would like to create, but I don't know how to successfully achieve this goal. I have 2 dataframes, one containing the mean value for each factor level, and the other, pairwise differences between these levels. contrasts
1

votes
2

answer
1.4k

Views

How to plot chinese characters on pdf?

My question is related to my previous question. How to plot bar plot with Chinese names in input file? I need to plot now chinese characters on pdf. mydata = matrix( c( 2:6, c( 2,4,2,6,3 ) ), nrow= 2 ) mylabs = c( '木材', '表', '笔', '垃圾桶', '杯' ) barplot( mydata, beside=T, horiz= 'T',...
Manish
2

votes
1

answer
136

Views

Animate scatter and contour plot

I am trying to generate an animated scatter plot within a functioning animated contour plot. I can get both working separately but not together. The code below generates the contour from coordinates A and B in the df. I've attempted to include a separated animated scatter within the sample plot usin...
jonboy
0

votes
0

answer
5

Views

A simple way of freeing Memory in python

For some time now, I am trying to solve my memory issues. I wrote a program to plot (and save the fig) oscilloscope .trc files. These contain 100 million data points. Matplotlib can plot one file but as soon as I put the plot operation in a for loop, it throws a MemoryError. The reason I put the plo...
0

votes
1

answer
14

Views

Seaborn and mplcursors

I have some data that I want to plot on a scatter chart, and display the associated label for each point. The data looks like xlist=[1,2,3,4] ylist=[2,3,4,5] labels=['a', 'b', 'c', 'd'] I can plot using Seaborn and tried to use mplcursor, but the displayed labels are the x and y instead of labels....
daydayup
1

votes
1

answer
2.4k

Views

Pandas Plotting with twinx

I'm attempting to have a bar plot and line plot on the same figure using Pandas matplotlib API. However, it is not going very well. I am using twinx() which seems to be the generally accepted way of accomplishing this. Note that this is done in a Jupyter notebook, with the plot being shown inline. T...
um8ra
1

votes
1

answer
5k

Views

Axes3D: Numpy arrays error while trying to build 3D plot

Let's start from the beginning. This how I getting x and y values: from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = fig.gca(projection='3d') # get current axis w0 = np.arange(30, 80, 1) # x - values w1 = np.arange(-3, 3, 0.1) # y - values X, Y = np.meshgrid(w0, w1) # no idea why to do...
Rocketq
1

votes
1

answer
3.1k

Views

Using pyplot to create grids of plots

I am new to python and having some difficulties with plotting using pyplot. My goal is to plot a grid of plots in-line (%pylab inline) in Juypter Notebook. I programmed a function plot_CV which plots cross-validation erorr over the degree of polynomial of some x where across plots the degree of pena...
tomka
1

votes
2

answer
696

Views

Adding a small table to a base graphics multiple plot chart [duplicate]

This question already has an answer here: Arrange base plots and grid.tables on the same page 1 answer I have a multiple plot chart: layout(matrix(c(1:4), 2, 2, byrow = FALSE),    widths=c(1,1), heights=c(1,1)) plot(1:6) plot(2:7) plot(3:8) I now want to add a small table in the bottom lower co...
adam.888
1

votes
2

answer
915

Views

Violin Plot in R using ggplot2 on multiple data columns

I am new to R, and trying to make violin plots of species count data for various species at each sampling depth. The data looks like the following Depth Cd Cf Cl 1 3.6576 0 2 0 2 4.0000 2 13 0 3 4.2672 0 0 0 4 13.1064 0 2 0 5 14.0000 3 17 10 6 17.0000 0 0 0 With species in columns...
Alexander
1

votes
1

answer
1.7k

Views

pcolormesh ticks center for each data point/tile

I have some z=f(x,y) data that I would like to display in a heat map. So I am using np.meshgrid to create a (x,y)-grid and then call pcolormesh. However the ticks are not centered for each 'tile' that correspond to a data point -- in the docs, I did not find any instructions on how to center the tic...
Faser
1

votes
1

answer
1.2k

Views

How to set alpha for the smoothing line in ggplot [duplicate]

This question already has an answer here: Control transparency of smoother and confidence interval 1 answer I am using alpha to set transparency for the smoothing line in ggplot but instead I get transparency only in the Error band that surrounds the fitted line. My code is the following: z1
rf7
1

votes
2

answer
452

Views

R: smoothing binned data in barplots with ggplot2

The data describe the distribution of commodities (apples and bananas) on the trees along the road between two villages, Villariba and Villabajo, which is 4000+ m long. The data are either already binned (i.e. are given summarized over every 500 m), or are supplied with big errors of locations, so b...
astrsk
1

votes
1

answer
59

Views

Long vertical bar plot with matplotlib

I need to create a Python script that plots a list of (sorted) value as a vertical bar plot. I'd like to plot all the values and save it as a long vertical plot, so that both the yticks labels and bars are clearly visible. That is, I'd like a 'long' verticalplot. The number of elements in the list v...
Titus Pullo
1

votes
2

answer
279

Views

Plotting Time and float value using python matplotlib from File

I am having a text file with time and a float value. I have heard that it is possible to plot these two columns using matplotlib. Searched similar threads but could not make it happening. My code and Data are- import math import datetime import matplotlib import matplotlib.pyplot as plt import csv w...
Pratik
1

votes
2

answer
66

Views

How can I plot four subplots with different colspans?

I try to fit four images using matplotlib.pyplot like the following: | plot1 | plot2| | plot3 | | plot4 | Most examples I found cover three plots like these: ax1 = plt.subplot(221) ax2 = plt.subplot(222) ax3 = plt.subplot(212) And this plots the three plots successfully (However, I don...
Ahmad
1

votes
1

answer
50

Views

Create quarterly dates vector for plot in Matlab

How can I transform this (much longer) vector into quarterly values like Q1-1991 etc. that plot nicely on a graph in Matlab? I googled/Matlab-help-searched/searched in this forum and didn't find anything. Dates = [19961; 19962; 19963; 19964; 19971; 19972]
LenaH
1

votes
4

answer
126

Views

Declaring two arrays in gnuplot and plotting them one with respect to another

Gnuplot version 5.2 supports arrays. As given here, one can declare 1D arrays and plot them array A[100] do for [i=1:100] { A[i] = sin(2*pi*i/100.) + 0.1*rand(0) } plot A This plots the matrix A with the index i. Is there a way to have two 1D arrays (Eg: x and y) and plot them y vs x. OR Declare a...
ASarkar
1

votes
1

answer
35

Views

How to define spacing of additional bar in barplot?

I want to plot y1, y0 and their ratio dy side by side. dy should appear at a small spacing behind the main bars. The (rotated) x-axis ticks should be centered under the three bars that belong together. I've been messing around with width and space as well as at options for a while but I haven't unde...
jay.sf
1

votes
2

answer
48

Views

Macro to run when file is protected

I did macro that creates a graph but need to make the file password protected. Of course, when I protect the file, the macro will stop working. I inserted the below into my code to unprotect the file, run the code, then protect the file again. As I the code is a function, I had to create two sub pro...
user9990184
1

votes
2

answer
43

Views

Color the group in ggplot violin plot

I am new to R programming. Stuck while plotting ggplot violin plot. I wish to give color blue, green and red color to my 3 groups. Here is my dataframe: > print(employee_withoutEmployeeID[1:5,]) > EnvironmentSatisfaction JobSatisfaction WorkLifeBalance 1 3 4...
Om Prakash Sao
0

votes
0

answer
9

Views

trying to plot Naive Bayes output but getting error - 'x' is a list, but does not have components 'x' and 'y'

I'm trying to plot a naive bayes result but getting Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' is a list, but does not have components 'x' and 'y' I used plot(nb). My dependent variable rating.text (is a factor). My independent variables mentioned are factors as well. data(df) nb
Ashwini Bv
1

votes
1

answer
58

Views

Adding barchart into tooltip of scatterChart in nvd3 - react component not rendering

I created a scatterChart from nvd3 and then tried to customize the tooltip the way it is described here: nvd3 piechart.js - How to edit the tooltip? using chart.tooltip.contentGenerator() approach: import React from 'react' import * as d3 from 'd3'; import nvd3 from 'nvd3'; var nv = nvd3; import Bar...
Nikita Vlasenko
1

votes
0

answer
123

Views

Error in colnames

Could anyone help me with some little problem? When I plot the frontier I get the following message: 'Error in colnames
Yury Bobr
1

votes
1

answer
293

Views

Changing date format when plotting xts object in R

Sadly this answer here seems to not work for me. From what I saw in the documentation, in the latest version, 0.10-1, the major.format parameter has been removed, opposed to previous versions, like 0.9-7, which has the major.format, that would solve easily my question. It seems such a major feature...
Miguel
1

votes
2

answer
278

Views

Find multiple max in a data (plot)

I have a list with Y values. If I plot it I get this: There are three dominant peaks visible. Question: Is there a way, in Python, to find the n-th most dominant spikes in a data list and print their x-position (in the list)? I need to take into account spikes with very small distance to each othe...
Paul G.
1

votes
1

answer
64

Views

Currently Animating Scatter Plot With Static Frames. Is there a way to animate over a moving window instead?

I have an array of arrays with format [2000][200,3] that I am creating an animated scatter plot of. 2000 is the number of frames and the interior arrays have format [length, [x,y,inten]] which are the points to scatter. So for an example a single frame will look like: Array[0]=np.array([x_1,y_1,I_1...
Ian Campbell Moore
1

votes
1

answer
29

Views

Show both 'active' and 'inactive' plots in knitr html output

For several correspondence analysis packages, single plot function generates multiple plots. The first plot is active, and the rest are inactive. Is there a way to print all plots one after another in the knitr html output. I am trying the following, which is not working. ```{r fig.keep='all'} libra...
S Das
0

votes
0

answer
3

Views

Analysing the residual normal probability plot

It's very basic question. I want to analyze the standardized residuals of the Linear Regression model. So I did the residual normal probability plot as following: model = LinearRegression(fit_intercept=True) x = df.temp x = np.asarray(x).reshape(-1, 1) model.fit(x, df.RH) y_predicted = model.predict...
demo
1

votes
2

answer
554

Views

aggregating values for bar plot

In R, I am attempting to make a bar plot that aggregates values from shared variables in a chart like so: counts3
MinkZ
1

votes
1

answer
529

Views

Python - 2/3D scatter plot with surface plot from that data

Using: [python] [numpy] [matplotlib] So I have a 3D array to create a scatter plot making a n * n * n cube. Those points have different values of potential represented by colors. size = 11 z = y = x = size potential = np.zeros((z, y, x)) Positive = 1...
Vasco Caniça
1

votes
0

answer
168

Views

Pandas plot table is not plotting all the columns

I am trying to plot the dataframe which is represented in an image. def count_of_each_categories(self,y_train=None,y_test=None,technology_segment=None): ''' :param y_train: :param y_test: :return: ''' df_train = pd.DataFrame() df_train[technology_segment] = y_train df_test = pd.DataFrame() df_train...
Nitesh kumar
1

votes
1

answer
418

Views

Plotting quadrants with axvspan

I am trying to plot four colored quadrants on a plot with a range of [-0.2,1.4] and [-0.2,1.4]. The issue is I'm having trouble trying to line up the y axis coordinates of the quadrants using plt.axvspan: roc_t = 0.43652219 roc_v = 0.82251961 plt.figure() plt.figure(figsize=(15,12)) plt.xlim(-0.2,1....
AToe
1

votes
1

answer
605

Views

How can I change the x-axis index date format in matplotlib?

My code below outputs the following image: from datetime import datetime as dt import matplotlib.pyplot as plt from matplotlib import style import pandas as pd import pandas_datareader.data as web import os start = dt(2017, 1, 1) end = dt.now() df = web.get_data_yahoo('AAPL', start, end, interval =...
NaN
1

votes
0

answer
50

Views

How to make a velocimeter-style plot in Python?

This is what I'm going for: velocimeter Is there anything in, say, matplotlib that can achieve this? I've looked at the matplotlib gallery but couldn't find anything that looks like it.
marco_gorelli

View additional questions