Closed Eneswar closed 4 months ago
Quick question, I couldnt find the answer on the wiki.
if I have this vector, is it possible to make a dotted line from the vector end to either axis?
Is it also possible to give these a name? like call the vector for v etc.
I just tried making that on my own and you should be able to do that but I found a bug with composing elements. I will work on fixing this and getting back to you.
@Eneswar I pushed an update that fixed the bug. For the graph that you want I think the following is what you are looking for.
```graph
bounds: [-10,10,10,-10]
elements: [
{type: "point", def: [4,5], att: {withLabel: false}},
{type: "arrow", def: [[0,0],"e0"], att: {name: "V", withLabel: true}},
{type: "segment", def: ["e0", ["f:e0.X()", 0]], att: {dash: 2}, att: {dash: 2, name: "X", withLabel: true}},
{type: "segment", def: ["e0", [0,"f:e0.Y()"]], att: {dash: 2, name: "Y", withLabel: true}},
]
To create names for elements you set the name attribute with a string and to display the name you set the withLabel attribute to true. With the name you can't use composed elements or functions in the name. If you want to for example automatically have the x value next to the x line you could create a text element with a function in the string getting the x value from the point and then in the attributes set anchor to element you want to anchor it to. The `toFixed()` function limits the amount of decimal places to show.
{type: "text", def: [0, 0, "f:e0.X().toFixed(1)"], att: {anchor: "e2"}}
If you don't want the point to show you can set the visible attribute to false.
The wiki is still a work in progress there are a lot of attributes that I am working on making good explanations for.
I'm glad that you are enjoying the plugin let me know if you have any other questions.
Thank you it works perfectly, I have two question if I may: 1: How would this affect the performance in the long run for obsidian? I have heard people that use tikz that they would start to feel a difference down the line.
2: Is it possible to use latex inside the code, similar to tikz? For example (im not home right now so I cant test it) id like to change the V here to something like {name: "$\vec{v}$", withLabel: true} .
Thank you it works perfectly, I have two question if I may: 1: How would this affect the performance in the long run for obsidian? I have heard people that use tikz that they would start to feel a difference down the line.
2: Is it possible to use latex inside the code, similar to tikz? For example (im not home right now so I cant test it) id like to change the V here to something like {name: "$\vec{v}$", withLabel: true} .
@Eneswar I just pushed an update that allows you to use LaTeX in text and label elements. All you have to do is put it in the inline math indicators and for LaTeX commands use two back slashes instead of one "$\\vec{v}$"
.
@Eneswar I just pushed an update that allows you to use LaTeX in text and label elements. All you have to do is put it in the inline math indicators and for LaTeX commands use two back slashes instead of one
"$\\vec{v}$"
.
That is awesome, thank you very much.
Sorry to bother you again, I have two questions.
Is it possible to put a label on y and x axis?
And when you use a segment, is it possible to put the name not on top of the line and more on the edge like as if its in arrow? (not a big deal, just wondering)
Thanks!
Sorry to bother you again, I have two questions. Is it possible to put a label on y and x axis? And when you use a segment, is it possible to put the name not on top of the line and more on the edge like as if its in arrow? (not a big deal, just wondering)
Thanks!
The following does what I think you want to be done.
```graph
bounds: [-10, 10, 10, -10]
defaultAxes: {
x: {name: "X", withLabel: true, label: {position: "rt", offset: [-10, 10]}}
}
elements: [
{type: "segment", def: [[0,0], [4,4]], att: {name: "$U=IR$", withLabel: true, label: {position: "rt"}}}
]
Using defaultAxes you can change apply attributes to the axes to change how they look. For labels you can change the position with "rt" meaning right and "lft" meaning left. You can also give an offset to a label from the position with an [x, y] value.
Just wanted to say thanks, I been busy with stuff and forgot to reply.
No issue, just wanted to say thank you for this awesome plugin!