ex-3: implement variable bins in the plot
This commit is contained in:
parent
dc845be7ef
commit
fca479aa63
@ -100,6 +100,11 @@ int main(int argc, char **argv) {
|
|||||||
// print histogram to stdout
|
// print histogram to stdout
|
||||||
if (opts.show_hist || opts.only_hist) {
|
if (opts.show_hist || opts.only_hist) {
|
||||||
fputs("\n# histogram\n", stderr);
|
fputs("\n# histogram\n", stderr);
|
||||||
|
/* Print the bins on the first line:
|
||||||
|
* this is needed by plot.py to make a
|
||||||
|
* 2D histogram plot.
|
||||||
|
*/
|
||||||
|
fprintf(stdout, "%ld %ld\n", opts.bins_theta, opts.bins_phi);
|
||||||
gsl_histogram2d_fprintf(stdout, hist, "%g", "%g");
|
gsl_histogram2d_fprintf(stdout, hist, "%g", "%g");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ from mpl_toolkits.mplot3d import Axes3D
|
|||||||
from matplotlib import cm
|
from matplotlib import cm
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
bins = tuple(map(int, sys.stdin.readline().split()))
|
||||||
xedges, yedges, counts = loadtxt(sys.stdin, unpack=True, usecols=[0,2,4])
|
xedges, yedges, counts = loadtxt(sys.stdin, unpack=True, usecols=[0,2,4])
|
||||||
bins = (30, 60)
|
|
||||||
counts = counts.reshape(bins)
|
counts = counts.reshape(bins)
|
||||||
|
|
||||||
plt.rcParams['font.size'] = 15
|
plt.rcParams['font.size'] = 15
|
||||||
|
Loading…
Reference in New Issue
Block a user