sage

How to add titles, axis label, and legend in sagemath?

How to add titles, axis label, and legend in sagemath? Question: I’m currently making some graphs using the online workbook hosted by sagemath. This is an example of some code I’m making to try and generate a graph: myplot = list_plot(zip(range(20), range(20)), color=’red’) myplot2 = list_plot(zip(range(20), [i*2 for i in range(20)]), color=’blue’) combined = myplot …

Total answers: 3

Conditional expressions in sagemath, when defining a symbolic expression

Conditional expressions in sagemath, when defining a symbolic expression Question: In SageMath, (version 4.7), I do this in the notebook: var("x y") dens(x, y) = 2 if y <= x else 0 and this gives no error. However, after that, dens(1, 1) returns 0, dens(1, 0.5) returns 0, and so on! In fact, I found …

Total answers: 2

SciPy Create 2D Polygon Mask

SciPy Create 2D Polygon Mask Question: I need to create a numpy 2D array which represents a binary mask of a polygon, using standard Python packages. input: polygon vertices, image dimensions output: binary mask of polygon (numpy 2D array) (Larger context: I want to get the distance transform of this polygon using scipy.ndimage.morphology.distance_transform_edt.) Can anyone …

Total answers: 6