histogram

GNUplot: how to plot rowstacked bar chart using color codes in data?

房东的猫 提交于 2019-12-02 02:15:38
I have the following sample data: col1 2 0 1 1 col2 1 1 0 0 col3 1 1 1 0 col4 1 1 2 1 col5 1 1 1 1 col6 2 0 1 1 col7 1 1 2 2 col8 1 1 2 1 columns #4 and #5 are the color codes for columns #2 and #3. For example, I want '1' for green, 2 for white, and 0 for orange. Here is how I tried to plot it: set key off unset border unset xtics unset ytics set style data histograms set style histogram rowstacked set boxwidth 1 relative set style fill solid 1.0 border -1 set yrange [0:2] set lmargin 0 set rmargin 0 set tmargin 0 set bmargin 0.1 set terminal pngcairo truecolor size 100,65 set output "/export

how to scale the histogram plot via matplotlib

橙三吉。 提交于 2019-12-02 01:29:01
You can see there is histogram below. It is made like pl.hist(data1,bins=20,color='green',histtype="step",cumulative=-1) How to scale the histogram? For example, let the height of the histogram be one third of it is like now. Besides, it is a way to remove the vertical line at the left? The matplotlib hist is actually just making calls to some other functions. It is often easier to use these directly allowing you to inspect the data and modify it directly: # Generate some data data = np.random.normal(size=1000) # Generate the histogram data directly hist, bin_edges = np.histogram(data, bins=10

GNUPLOT - Can't display values over the bar

百般思念 提交于 2019-12-02 01:17:10
I'm trying make simple histogram with this file '.dat' Moment "Energy consumed (MWh)" "Apr-16" 2011.4 "May-16" 1869.6 "Jun-16" 1899.0 "Jul-16" 1659.0 "Aug-16" 1740.6 "Sep-16" 1670.0 For this purpose I have written the following script #!/usr/bin/gnuplot set term postscript set terminal pngcairo nocrop enhanced size 700,700 font "arial,18" set termoption dash set output out set boxwidth 0.5 absolute set border 0 set style fill solid 1.00 border lt -1 set key off set style histogram clustered gap 1 title textcolor lt -1 set datafile missing '-' set style data histograms set xtics border in scale

Histogram in R - x-axis not centered properly

二次信任 提交于 2019-12-02 00:09:43
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 7 years ago . I have a histogram from a list d of values that I make by simply typing hist(d) And this is what I get: How can I make it such that the x-axis extends all the way left to the origin of this plot (the bottom left corner)? Why does it cut off at -0.4? 回答1: Macro's answer is by far the simplest route. However, if you really are unhappy with with the default behavior of hist

how to plot histogram using RGB pixel value?

半世苍凉 提交于 2019-12-01 23:17:29
i m make App in netbeans platform. i want to draw hisrogram. i have Red, Green ,and Blue color's pixel of image. so, please any one suugest to me that how can i plot histogram using this pixels value? my code is below ,in which i take RED,GREEN, and BLUE pixel value of image. enter code here import java.awt.Component; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class WalkImageTest10 extends Component { public static void main(String[] foo) throws IOException { WalkImageTest10 wa= new WalkImageTest10(); } public void

gnuplot x label position in histogram

为君一笑 提交于 2019-12-01 22:37:49
问题 i have the following data: t_4 24 3 0 0 t_6 37 4 0 0 t_8 51 4 2 0 t_4 15 1 0 0 t_6 21 0 0 1 t_8 30 0 0 1 t_4 13 2 1 0 t_6 20 3 1 0 t_8 22 4 1 0 and i try to make an histogram similar to this http://www.bmsc.washington.edu/people/merritt/gnuplot/stack+cluster.dem , with this modify version of the code: set style data histogram set style histogram rowstacked set style fill solid set boxwidth 0.5 set key invert samplen 0.2 set key samplen 0.2 set bmargin 3 set offset 0,2,0,0 set title "number of

Plotting a histogram with overlaid PDF

巧了我就是萌 提交于 2019-12-01 22:31:40
This is a follow-up to my previous couple of questions. Here's the code I'm playing with: import pandas as pd import matplotlib.pyplot as plt import scipy.stats as stats import numpy as np dictOne = {'Name':['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth', 'Seventh', 'Eighth', 'Ninth'], "A":[1, 2, -3, 4, 5, np.nan, 7, np.nan, 9], "B":[4, 5, 6, 5, 3, np.nan, 2, 9, 5], "C":[7, np.nan, 10, 5, 8, 6, 8, 2, 4]} df2 = pd.DataFrame(dictOne) column = 'B' df2[df2[column] > -999].hist(column, alpha = 0.5) param = stats.norm.fit(df2[column].dropna()) # Fit a normal distribution to the data print

Change JFreeChart Histogram colors dynamically?

痴心易碎 提交于 2019-12-01 18:36:21
I'm trying to show the histogram of an image and show only some colors. I've already done that with JFreeChart and createXYLineChart and getting all the data by iterating over all pixels. To speed it up I'm trying to do it with "createHistogram". I've followed this code . To update the chart with the new values I've used this two methods: XYPlot plot = (XYPlot) chart.getPlot(); plot.setDataset(setHistogram(red, green, blue)); Being setHistogram a method which returns a HistogramDataset depending on which checkbox are activated (boolean red, green and blue). That works properly as intended. The

Count strings occurrences and plot histogram

寵の児 提交于 2019-12-01 17:29:16
Is there any straightforward way to create a histogram from a cell array like the one below? The spacing between the consecutive bars should be exactly the same and the labels of the x-axis should be the corresponding names of the variables below in a vertical orientation. 'w464' 'w462' 'w461' 'w464' 'w461' 'w463' 'w466' 'w461' I would like to know a better way, as well. Fwiw, I have used countmember in a roundabout way to plot data like this. I.E. if the data you posted was named A >> B={sort(unique(A)) countmember(sort(unique(A)),A)}; >> bar(B{2}); >> set(gca,'XTickLabel',B{1}) If you have

count specific characters in a string (Java)

ぐ巨炮叔叔 提交于 2019-12-01 17:10:14
I have a homework assignment to count specific chars in string. For example: string = "America" The output should be = a appear 2 times, m appear 1 time, e appear 1 time, r appear 1 time, i appear 1 time and c appear 1 time public class switchbobo { /** * @param args */ // TODO Auto-generated method stub public static void main(String[] args){ String s = "BUNANA"; String lower = s.toLowerCase(); char[] c = lower.toCharArray(); // converting to a char array int freq =0, freq2 = 0,freq3 = 0,freq4=0,freq5 = 0; for(int i = 0; i< c.length;i++) { if(c[i]=='a') // looking for 'a' only freq++; if(c[i]