Hi! I am a newbie in this topic, so I may ask a du...
# datascience
n
Hi! I am a newbie in this topic, so I may ask a dumb question, but I will be really grateful for answers. I have a
Map<OpenEndRange<Double>, Int>
, where keys are openEndRange of double and values are how many numbers are in those ranges. (I attached screenshots.) I change this map to look like this
{Ranges=[0.0, 0.75, 1.5, 2.25, 3.0, 3.75, 4.5, 5.25], Values=[17, 6, 13, 27, 11, 8, 14, 4]}
(it's dataBar variable), where in "Ranges" only start points of the range. I am trying to use lets-plot in Jupyter Notebook for creating a histogram when on the x-axis will be ranges and on the y-axis will be how many numbers are in those ranges. But it doesn't look like how I expected. Could anyone help me, please? Or give some learning materials on lets-plot? Or maybe you would recommend another library for creating histograms?
I created what I needed using Plotly-kt.
Copy code
Plotly.plot {
    bar { 
        @OptIn(ExperimentalStdlibApi::class)
        x(*rangeToCount.keys.map {it.toString()}.toTypedArray())
        @OptIn(ExperimentalStdlibApi::class)
        y(*rangeToCount.values.toTypedArray())  
    }

}.makeFile()
But still, I will be thankful If you can explain why I can't do the same in lets-plot
image.png
a
Hello! 1.
geomBar()
uses “count” stat by default (i.e. does not use the user-defined values as y, but rather counts the number of observations for each x), so in your example, you need to specify “identity” as a stat. 2. Since lets-plot does not support ranges as a data type, you need to cast them to a
String
manually
n
@Andrei Kislitsyn, thank you very much