how to 'plt.scatter' with different colors (is it possible?)
onofricamila opened this issue · comments
Camila Onofri commented
Hi! I was checking the library, and just could not plot points with different colors (tryed plot() for the "scatter" thing, and then pcolor() for the colors ...).
I would like to plot the following (from the provided examples) with different colors ... is it possible?
List<Double> x = NumpyUtils.linspace(-3, 3, 100);
List<Double> y = x.stream().map(xi -> Math.sin(xi) + Math.random()).collect(Collectors.toList());
Plot plt = Plot.create();
plt.plot().add(x, y, "s").label("sin");
plt.title("scatter");
plt.legend().loc("upper right");
show(plt);
Thanks in advance!
Sho Nakamura commented
Hi @onofricamila .
I have quickly added .color()
option to PlotBuilder. Now you can color the points with master branch codes as
plt.plot().add(x, y, "s").label("sin").color("red");
Harsh Patel commented
Do we have any option to set different colors for different (x,y) points in the same Plot graph ? If yes, could you please help me with any refernces for that ?