histogram

How do I save histogram to file in matlab?

六月ゝ 毕业季﹏ 提交于 2020-01-06 12:59:06
问题 figure; histogram = hist(np,180); name=['histogram-' int2str(k) '.png']; %% k is the iterator so basically I want to save all the images using a loop. imwrite(out,name); The image I got is only a horizontal line. Does someone know how to fix this? 回答1: you can use savefig instead of imwrite here is the doc http://www.mathworks.ch/ch/help/matlab/ref/savefig.html savefig(h,filename) h is the handle of figure. you could skip h to save the current figure. (edit) savefig may not be there depending

How to make a histogram from this nc file?

核能气质少年 提交于 2020-01-06 12:47:52
问题 I'm a research assistant and I've recently started to learn python to interpret model output in netCDF file format. Let me give a quick background on my question: I have already searched through a certain grid area of a netCDF file using the netCDF4 module and stored an array of times, which I then converted to a list of dates using netCDF4's num2date feature. I have shown my code below. Please note that restrictedrange is a subset of a variable from an nc file and rmduplicates() is not shown

When I plot 2 columns one over the other, a different graph is plotted

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 08:30:25
问题 I have 2 columns from 2 np.arrays of the same size. When I plot the only the one I get this result: plt.figure(figsize=(70,10)) for i,h in enumerate(clean_head): plt.subplot(1,6,i+1) #plt.hist(non_fire[:,i],alpha=.3) plt.hist(fire[:,i],alpha=.3) plt.title(clean_head[i]) # plt.tight_layout() When I plot both I get this: plt.figure(figsize=(70,10)) for i,h in enumerate(clean_head): plt.subplot(1,6,i+1) plt.hist(non_fire[:,i],alpha=.3) plt.hist(fire[:,i],alpha=.3) plt.title(clean_head[i]) # plt

How to plot 3D histogram of HSV and CIELAB values?

南笙酒味 提交于 2020-01-06 05:43:09
问题 I want to code a 3D histogram to develop a clustering algorithm in CIELAB space. I started with the 3D histogram in RGB space, which I found through this thread, and expanded to HSV as a springboard to CIELAB. I checked that the labels and values work for RGB images. I got most of the way there but a few things are off for HSV. Here is my refactored version of the code: # Histogram and plotly code from # http://reynoldsalexander.com/3dhistplots.html # and non-notebook plotting from # https:/

Generating Histogram through Java and PrimeFaces

一曲冷凌霜 提交于 2020-01-06 05:38:21
问题 I am having trouble in generating histogram through java prime faces.I have this xhtml file. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> <ui:define name="content"> <h1 class="title ui-widget-header ui-corner-all"

Change bins on y-axis with seaborn

你。 提交于 2020-01-06 05:27:12
问题 I try to work out some way to plot data as a histogram. Now I realized that the numbers on the y-axis don't represent the actual counts of data points in my file. Is there a way I can change that? My code looks like this sns.set_style("white") plt.figure(figsize=(12,10)) plt.xlabel('a', fontsize=18) plt.ylabel('Frequency', fontsize=18) plt.title ('Title of Graph', fontsize=22) sns.distplot(st,bins='fd', kde=False, fit_kws={"color":"red"}, fit=sp.stats.norm, hist_kws={"rwidth":0.75, 'range':(0

Combining 2 joyplots with same x-axis

前提是你 提交于 2020-01-06 05:24:26
问题 I have a code for plotting ridgeplot ( joyplot ). import joypy fig, axes = joypy.joyplot([RZS_P['RZ'][(RZS_P['P_2001'] > range_P[i]) & (RZS_P['P_2001'] <= range_P[i]+500)] for i in range(8)], ylim='own', overlap = 1, bins = 20, figsize=(6,8), alpha = 1, labels = labels,grid=True, color ='black', fill = False, lw = 2) for i in range(len(sample)): plt.xlim(0,800) ######### The code below is for different data with same x-axis fig, axes = joypy.joyplot([RZS_P['Rootzone'][(RZS_P['P_2012'] > range

Conditional coloring of histogram graph in MATLAB

笑着哭i 提交于 2020-01-06 01:29:25
问题 I have a histogram that I want conditional coloring in it with this rule : Values that are upper than 50 have red bars and values lower than 50 have blue bars. Suppose that we have this input matrix: X = [32 64 32 12 56 76 65 44 89 87 78 56 96 90 86 95 100 65]; I want default bins of MATLAB and applying this coloring on X-axes (bins). I'm using GUIDE to design my GUI and this histogram is an axes in my GUI. This is our normal graph. Bars with upper values than 50 should be red and bars with

Wrong legends when plotting histogram with `hold on`

本小妞迷上赌 提交于 2020-01-05 09:05:31
问题 I am plotting histograms on a subplot, where each plot has two histograms as shown in one part of the subplot below: Question: I would want the hist with variable named result_uT_per_window to have red legend, and hist with variable named uT_top_of_global_window to have blue legend. I thought what I have in code is supposed to do that, but it doesn't. This is the code: hold on hist(nonzeros(result_uT_per_window(:,window_no))) hist(uT_top_of_global_window) h = findobj(gca, 'Type','patch'); set

How can I add the counts to the histogram plot?

人盡茶涼 提交于 2020-01-05 08:27:43
问题 I want to add the counts data of histogram to the plot in matplotlib. Here is my data; import matplotlib.pyplot as plt data = [['B', 1], ['C', 2], ['A', 3],['A', 4], ['B', 5], ['B', 6],['A', 7], ['B', 8], ['C', 9],['D',10]] df = pd.DataFrame(data, columns = ['Name', 'Count']) plt.hist(df['Name']) plt.show() The result is like this; result1 I tried to use plt.text and value_counts() but their sorting are different... import matplotlib.pyplot as plt data = [['B', 1], ['C', 2], ['A', 3],['A', 4]