I am about to cry, I am so confused and lost. I’ve looked all over the processing.org resources but maybe my question is just too simple for it. I can’t figure out how to create and name an axis or how to create the little hash marks.
This is my code so far:
JSONObject cat=cats.getJSONObject(0); //This tells processing to retrieve the first object in the cats array.
text("madf graph",250,40); //the title
rect(i*30 + 80, 310, 30, -age*20);
You can achieve anything if you work at it and persevere. I know this from experience.
Your codes so far is a good start.
This is a simple exercise.
Start working with lines and plotting them; the example shows plotting of rectangles and lines are much easier.
Notice that offsets (+80) and variables (-age*20) are used in plotting rectangle and can apply to lines.
rect(i*30 + 80, 350, 30, -age*20);
Add a background otherwise you keep redrawing over the screen and it looks worse.
Plot the lines and labels after the loop so you are not drawing them over each other unnecessarily.
I worked through this exercise and it is achievable for you:
The key concept to understand is that Processing is fairly low-level. It doesn’t have commands like “create and name an axis” – it has commands like “draw a line” – then you tell it where to draw the lines to make the axes, like you would with a pencil on paper.
If you want to create axes with higher-level commands, there are libraries – like Grafica – that do have higher-level things like axis commands for doing this: Default plot sketch - jagracar . However you have posted what looks like an exercise or homework assignment, so using a library is probably not the point of what you are learning – you are learning how to think through how to make the lines and hashes yourself, and where they go.