1
$\begingroup$

I have a list of values :

m = Table[
  6.02*10^32*20*3.154*10^7*0.86*
   NIntegrate[\[Phi]n2[b]*f1[b]*10^-38, {b, i, i + 2}, 
    MaxRecursion -> 20, WorkingPrecision -> 10], {i, 19, 29, 2}]

These are the y values. Now I have to plot these values with x from 19 to 31 and each value is for a interval of of 2 i.e from 19-21, 21-23 and so on. How to proceed?

$\endgroup$

2 Answers 2

1
$\begingroup$
ledges = Range[19, 29, 2]
labels = StringTemplate["``-<*2+#*>"] /@ ledges
f1 = \[Phi]n2 = Function[x, x]  (* for illustration *)
m = Table[
  6.02*10^32*20*3.154*10^7*0.86*
   NIntegrate[\[Phi]n2[b]*f1[b]*10^-38, {b, i, i + 2}, 
    MaxRecursion -> 20, WorkingPrecision -> 10], {i, ledges}]
BarChart[m, ChartLabels -> labels]

enter image description here

$\endgroup$
0
$\begingroup$
SeedRandom[7];
m = 10^6 RandomReal[10, 6]
{8.29905*10^6, 7.00287*10^6, 6.20283*10^6, 6.48944*10^6,
 9.15531*10^6, 7.19435*10^6}
binlist = Range[19, 31, 2]; 

You can use m & as the height specification in the third argument of Histogram:

Histogram[{1}, {binlist}, m &, Ticks -> {Range[19, 31, 2], Automatic}]

enter image description here

You can also use ListStepPlot as follows:

ListStepPlot[m, Right, 
 DataRange -> {19, 29}, 
 Filling -> Axis, 
 Ticks -> {Range[19, 31, 2], Automatic},
 PlotRange -> {Automatic, {0, All}}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.