I was trying to do some bar plots in Roassal and I have some feedback concerning the api.
Let's say that I have 2 collections of data that I want to plot.
The first collection contains class names as strings. The second one number that says how many object that class created.
In Python using matplotlib, with this code I have a plot:
plt.bar(classes, created_objects)
# Show me the x labels in a vertical way because my class names are too long
plt.xticks(rotation='vertical')
# Add labels to the axis
plt.xlabel('Classes')
plt.ylabel('Number of Created Objects')
plt.show()
Doing the same but in Roassal:
"Create the bar plot"
barPlot := RSBarPlot new
x: (1 to: createdObjects size)
y: createdObjects;
yourself.
"Add the plot to a chart"
chart := RSChart new.
chart addPlot: barPlot.
"Say to include vertical labels, they are not added by default.
Note that we are sending the message to the chart, not to the plote"
chart add: RSVerticalTick new.
"Same here, but also tell the x labels to show in vertical form because the class names are too long"
chart addDecoration: (RSHorizontalTick new
useVerticalLabel;
fromNames: classes;
yourself).
"Add labels to the axis"
chart xlabel: 'Classes'.
chart ylabel: 'Number of Created Objects'.
"Show me the plot"
chart build.
chart canvas
Both of the pieces of code produces a very similar bar plot. Really almost the same plot. But, as you can see, the api of matplot lib is minimalistic.
In Roassal, for adding the x elements to the bar plot I cannot pass the classes collection (!) I need to create another collection from 1 to the sizes.
Then I need to add the plot to a chart, Then I need to create objects to have the labels.
For seeing the classes names I need to create another object and then using my classes collection.
For me, it should not be necessary to do (1 to: createdObjects size) because we know the size of the collection why don't using directly the class colletion and adding automatically the labels.
Also, why do I need to create a canvas? Why the labels are not included by default?
We should remove responsabilities to the user, for example not let her/him deal with the canvas creation and decorations.
Dealing with the canvas should be necessary only if I do some complex and personalized charts. But for doing simple stuffs, like having a bar plot, it's really complicated.
I missed the the Roassal meeting but I saw that you were using a DataFrame to have the graphs. I also don't want to be forced to use a DataFrame to plot.
I have 2 collections, I don't think I should create a DataFrame for doing it. As you saw in the python code, matplotlb is independent of pandas (DataFrame Pharo = pandas Python), but also we can use it with a pandas object, but we are not forced to do so.
I was trying to do some bar plots in Roassal and I have some feedback concerning the api.
Let's say that I have 2 collections of data that I want to plot. The first collection contains class names as strings. The second one number that says how many object that class created.
classes := {'PharoDarkTheme'. 'UITheme'. 'ImageMorph'. 'ScrollBarMorph'. 'RubScrollBar'. 'PanelMorph'. 'RubTextScrollPane'. 'AligmentMorph'. 'SliderMorph'. 'BreakpointIconStyler' }.
createdObjects := #( [10492 4222 1676 1296](callto:10492 4222 1676 1296) [1097 767 300 252 216](callto:1097 767 300 252 216) 203 ).
In Python using matplotlib, with this code I have a plot:
Doing the same but in Roassal:
Both of the pieces of code produces a very similar bar plot. Really almost the same plot. But, as you can see, the api of matplot lib is minimalistic.
In Roassal, for adding the x elements to the bar plot I cannot pass the
classes
collection (!) I need to create another collection from 1 to the sizes. Then I need to add the plot to a chart, Then I need to create objects to have the labels. For seeing the classes names I need to create another object and then using myclasses
collection.For me, it should not be necessary to do
(1 to: createdObjects size)
because we know the size of the collection why don't using directly theclass
colletion and adding automatically the labels. Also, why do I need to create a canvas? Why the labels are not included by default? We should remove responsabilities to the user, for example not let her/him deal with the canvas creation and decorations. Dealing with the canvas should be necessary only if I do some complex and personalized charts. But for doing simple stuffs, like having a bar plot, it's really complicated.I missed the the Roassal meeting but I saw that you were using a DataFrame to have the graphs. I also don't want to be forced to use a DataFrame to plot. I have 2 collections, I don't think I should create a DataFrame for doing it. As you saw in the python code, matplotlb is independent of pandas (DataFrame Pharo = pandas Python), but also we can use it with a pandas object, but we are not forced to do so.