One way to do that kind of "scatterplot" ( not "histogram") is to use Python's MatPlotLib which gives you complete
control over color, size,shape, alpha, of the plot. Of course you have to have python installed and you need to
point your pathway to the python executable, once, as described in the NetLogo Documentation.
Documentation on scatterplot in MatPlotLib
If you do that, the following Netlogo code below will produce this if you run setup, then "testplot"
and this if you run setup then "scatterplot" which reads the AAA and BBB values from turtles
and plots it.
Here's the total Netlogo code that runs correctly for me. I think you need
Netlogo 6.3, as 6.2x had some issue with python.
;;============= Netlogo 6.3 code =======
extensions [py]
turtles-own [ AAA BBB ]
to setup
clear-all
create-turtles 10 [ set AAA who set BBB (who ^ 1.3) ]
reset-ticks
end
to scatterplot
print "Setting up python now"
py:setup py:python
let xlist [ ]
let ylist [ ]
ask turtles [ set xlist lput AAA xlist set ylist lput precision BBB 3 ylist]
print xlist
print ylist
py:set "x" xlist
py:set "y" ylist
carefully [
(py:run
"import matplotlib"
"matplotlib.use('TkAgg')"
"import numpy as np"
"import matplotlib.pyplot as plt"
"plt.scatter(x, y )"
"plt.show()"
)
] [ print "ran into some problem running python." ]
py:run "print('python finished')"
print "End of plot routine"
end
to testplot
print "Setting up python now"
py:setup py:python
show py:runresult "1 + 1"
carefully [
(py:run
"import matplotlib"
"matplotlib.use('TkAgg')"
"import numpy as np"
"import matplotlib.pyplot as plt"
"N = 50"
"x = np.random.rand(N)"
"y = np.random.rand(N)"
"colors = np.random.rand(N)"
"area = (30 * np.random.rand(N))**2 "
"plt.scatter(x, y, s=area, c=colors, alpha=0.5)"
"plt.show()"
)
] [ print "ran into some problem running python." ]
py:run "print('python finished')"
print "End of plot routine"
end
;;====================
Wade