... had no effect though.
Before getting to the main issues, I want to check that you are re-generating the images. After making such changes, you have to re-run the mbx script to produce new image files, and then also make sure that they are uploaded to the right place. Re-running xsltproc alone won't change certain things (which I have been guilty of forgetting, so I wanted to check).
Yes, you're right. Your first image made me think "Cartesian" and my mind went straight to pgfplots. A suggested approach for your situation outlined below.
So I am assuming that you have not globally changed the length of x-units and y-units for tikz drawing, which is 1cm by default. When you say (0,3.5), that will be 3.5 cm upward from (0,0). Side note: if it will ultimately be more convenient, you can change this with something like
\tikzset{x=2cm,y=1.5cm}
in your docinfo/latex-image-preamble. I would recommend only setting these globally (if at all) to better control consistency in your project.
I recommend avoiding the scale=0.75 option for resizing a tikz image. If that 0.75 varies from image to image, this is one of the things that will make your dots vary in size from image to image. It simplifies the balancing act if you stop worrying about this. If you want a different sized image, you use one with a different range of x- and y-values. With these two images below in a .tex file, the latter will be 0.75 as big in both dimensions just by virtue of having all the coordinates scaled by 0.75. Note the circle radii are not rescaled by 0.75. [Using scale=0.75 does rescale those radii.]
\begin{tikzpicture}
\draw[thin, gray!50] (0,0) grid (3.5*0.75, 3.5*0.75);
\draw[->, thick] (0,0) -- (0,3.5*0.75) node{Hello};
\draw[->, thick] (0,0) -- (3.5*0.75,0);
\fill (1*0.75,2*0.75) circle (3pt) (2*0.75,1) circle (3pt) (3*0.75,3*0.75) circle (3pt);
\end{tikzpicture}
I get it that all those *0.75 are irritating. So if you insists, keep using scale=0.75, but then you need to draw your dots (and maybe other things?) in a scale-independent way. Like:
\draw (1,2) node[fill,circle,minimum size=3pt] {};
This way the radius is not coordinate-based and so will be unaffected by scale=0.75. I'd even package this into a macro up in latex-image-preamble so that you could do something like:
\draw (1,2) soliddot;
But off the top of my head I don't recall how you define such a macro.
Anyway, for your book, I recommend mapping out coordinates of points based on how they will land in the print edition, literally interpreting 3.5 as 3.5cm, etc. Always be able to tell from looking at your code what the width in cm will be in your print version. And stay conscious of things like the dot radii which you do not want to rescale with use of scale=.
Now, how to get the images to be properly sized in HTML? First, a primer: If you give the surrounding image a width attribute, and we are talking about an image with latex-image-code in it, then the tex output will completely ignore that width attribute. It is only used in the tex end to scale an existing external image that will be pulled in via \includegraphics.
But the width attribute will be used faithfully in the HTML. At present there is no requirement to use a percentage width here, but since your users may use small screens it's recommended you plan with percentages. So you could plan that "100%" width corresponds to what "10cm" would be in your print book. Note, I'm not saying that 100% will equal 10cm in the HTML. Just establishing a baseline.
The second of the above examples can be seen to pretty close to 3.5*0.75 cm = 2.625 cm wide. It's actually a tiny bit more because the arrowhead on the y-axis sticks out more to the left. But it is reasonable to ignore that. So if you gave that image the attribute width="26.25%", it will be scaled just so in the HTML. Following a scheme like this throughout all of your coordinate-based tikz diagrams should make them appear consistent.
If the image in a sidebyside, you'll know that it your MBX source, and you need to pump up the percentage accordingly. Ignoring margins, padding, etc for now, you'd use an image with width="26.25%" if it were inside a sidebyside figure whose width was 50%.
- Remember to recompile and if necessary, reupload images.
- I already mentioned making a macro for your dots. Similarly, I'd make a style in latex-image-preamble for the axes here instead of direclty using [->, thick] over and over. And the same for the grid style.
If this doesn't work out, please post minimal MBX code (including latex-image-code) for two images that are supposed to be of different sizes but have same-sized elements. And put a third such image in there inside a sidebyside.
I think you would have the same issue but you can try. The raw, unembedded png probably looks exactly the same as the unembedded svg. And then the HTML/CSS positioning will stretch them in the same manner.