I want to add a XY axis with labels as a border to a jpg. In other words I want to wrap the axes around a predawn picture. How can I do that in illustrator or photoshop. Earlier, I tried cropping out the body of the axes and pasting with my desired image, but that is very difficult and not giving me desirable results.
Open Excel (or some other spreadsheet program, OpenOffice has a free one) and make a graph with the wanted XY scales. You probably get a too complex result, but that can be edited.
In Excel, it's easy to remove fills, texts and markers, you can even make the gridlines white if you want. I let them be. The proportions can be scaled freely, too.
Now it's possible to copy the result in Photoshop and paste it as a new layer to the image. Layer blending mode multiply fades all white, only black parts are visible as an overlay.
I do not recommend going directly to Photoshop, because you get only screen resolution. Copy the graph and paste it instead to Illustrator for edits. It comes there as an editable vector drawing.
You must release the Clipping Mask and Ungroup all to get it editable.
The next screenshot is from Illustrator after pasting, releasing the clipping mask, ungrouping and deleting the unwanted parts that Excel has added. You do not believe how much you must delete unnecessary visible and invisible lines and rectangles until you have this and only this, but nothing which is hidden:
Note: I have just increased the line width to 0,25mm because it was a zero width hairline from Excel.
In Illustrator you can insert anything that you have, draw or write, for example your photo. As well you can copy and paste the cleaned and edited coordinates to Photoshop and continue there.
You can easily make the coordinates to appear as frame in Illustrator - only duplicate and move the items. Here the parts of the X scale have been copied and moved to the top. A random screenshot image from a recent GDSE case was added, but you can place from a file a photo or any Illustrator compatible graphic or draw and write what you like using Illustrator's tools.
If you must make several different coordinate frames for different images, you can reuse what you already have in Illustrator. The numbers are still editable separate objects like every other piece. To keep the parts together do groupings and make spares.
Warning: I used a legacy Excel to get reasonably simple graph in the beginning. Modern Excel adds much more decoration without asking. You must delete much more to get reasonably simple result. Open Office is a little better. The whole work can be done in Open Office applications.