1
$\begingroup$

I have an x and y data, x is in log scale and y is in linear scale. I am trying to plot the histogram between these two data. How to do it? and also how to customize the width of the individual rectangle of the histogram. Below is How I tried

data={{12.5,61.42},{16,56.81},{20,56.7},{25,57.62},{31.5,56.76},{40,63.88},{50,72.13},{63,76.55},{80,71.44},{100,61.58},{125,61.12},{160,52.84},{200,59.99},{250,58.84},{315,53.06},{400,55.39},{500,54.05},{630,52.82},{800,46.94},{1000,50.28},{1250.,54.56},{1600.,56.71},{2000,54.93},{2500.,52.53},{3150.,46.46},{4000,45.28},{5000,45.75},{6300.,45.14},{8000,42.27},{10000,43.35},{12500.,42.6},{16000,38.8},{20000,35.36}};

p[1] = Show[ Table[ListLogLinearPlot[data, Joined -> True,PlotStyle -> {Red, Thickness[0.002]}], {i, 1, Length[komodo]}], PlotRange -> All]

Histogram[data]

$\endgroup$
5
  • $\begingroup$ A histogram is typically constructed with counts or relative frequencies. What are the units of data[[All,2]]? Those values sum to 1783.96. Do you want a BarChart rather than a Histogram? $\endgroup$ – JimB Nov 25 '20 at 5:36
  • $\begingroup$ Actually, I am plotting the sound levels in dB vs frequency in Hz. I don't know is it possible that if look at how both bar chart and histogram turn up and decide later? $\endgroup$ – acoustics Nov 25 '20 at 5:42
  • $\begingroup$ I don't think a decision based on "I'll know it when I see it" should be satisfying. $\endgroup$ – JimB Nov 25 '20 at 5:53
  • $\begingroup$ Ok the standard practice in journal papers is to plot using the histogram. $\endgroup$ – acoustics Nov 25 '20 at 5:55
  • $\begingroup$ Providing a journal example of what you want would get you more more targeted help. $\endgroup$ – JimB Nov 25 '20 at 6:15
3
$\begingroup$

I wonder if something like this is what you’re after:

ListLogLinearPlot[
  data,
  Filling -> Axis, 
  FillingStyle -> Thickness[0.02],
  Axes -> False, Frame -> True
]

simulated histogram

$\endgroup$
4
  • $\begingroup$ The x-axis is cutting the histogram at the bottom. Is it possible to overcome that? $\endgroup$ – acoustics Nov 25 '20 at 6:05
  • $\begingroup$ @acoustics see edit. You can apply any of the usual plot styling and formatting of course (colors, etc). $\endgroup$ – MarcoB Nov 25 '20 at 6:11
  • $\begingroup$ I tried changing the color but it is not happening. how to make it work $\endgroup$ – acoustics Nov 26 '20 at 12:19
  • $\begingroup$ @acoustic Use something like ‘FillingStyle -> Directive[Red, Thickness[0.02]]‘ $\endgroup$ – MarcoB Nov 26 '20 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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