Question: How do I plot a histogram with a labelled legend in Maple 2022? The Maple 2021 method no longer works. Is Histogram( ) different now?

I upgraded to Maple 2022 and some of my old sheets from Maple 2021 don't work anymore. When I plot a histogram with a legend I get an error saying: Error, invalid input: Statistics:-Histogram expects value for keyword parameter legend to be of type list, but received data set 1.

OK so maybe Histogram changed in 2022 although I didn't think it did. I ran it in Maple 2021 and I received no such error message. I chose to comply with the error message and the plot is output without an error message, however the legend labels carry extra characters I don't want to be there.  My attempt at a solution was to first use square brackets to make the object a list, then use the typeset command to typeset the label.  Strangely, the typeset command was not recognized.

What am I doing wrong? All I want is to plot a histogram with a legend labelled by a string which I have done many times in the past. I have attached below, a maplesheet which explicitly shows the problematic behaviour.

Thanks,
N

restart

NULL

with(Statistics)

with(LinearAlgebra)``

with(plots)``

NULL

NULL

Define Random Variable

X := RandomVariable(Normal(1, 2))

_R

(1)

Sample that variable and plot a histogram.

s := Sample(X, 1000)

NULL

Maple 2022 as opposed to Maple 2021 does not consider this a valid way to define the legend. It want's it defined in a list as requested in the pink error message.

Histogram(s, legend = "data set 1")

Error, invalid input: Statistics:-Histogram expects value for keyword parameter legend to be of type list, but received data set 1

 

NULL

NULL

Maple 2022 as opposed to Maple 2021 does not consider this a valid way to define the legend. It works fine in Maple 2021. Maple 2022, want's it defined in a list. This works but, the square brackets and quotation marks appear when I don't want them to. The legend shouldn't have these extra quotations and brackets, just the desired name.

Histogram(s, legend = ["data set 1"], size = [300, 300])

 

I tried the typeset command. It doesn't seem to be recognized anymore.

 

Histogram(s, legend = [typeset("data set 1")], size = [300, 300])

 

What am I doing wrong? All I want is to plot a histogram with a legend labelled by a string.   

Download legend_as_list.mw

Please Wait...