How to insert symbol for negative x and y-axes also change size and style of number in number line?

Math123 shared this question 7 months ago
Answered
Best Answer
photo

improved

Comments (60)

photo
1

Need your assistance.

photo
1

You remember?

https://help.geogebra.org/t...

I think it's very near or equal what you are looking for.

photo
1

Thanks rami for reply. But in this question i have different requirement.

1. Rght Click -> Graphics -> x-aix Label (Put label right side of x-axis ---- I need label -x axis as well on left side same as in -y axis with different size and font style)

2. Right Click -> Graphics -> Basics (Number of axis in different fonts style and size).

photo
1

I don't like moved targets. Please create complete descriptions in the first post.

If I understand correct: what you want is not possible. Because the rigth click on Graphics (background) give a context-menue and not an event to start a scripts. Instead you can for example use a check-box.

But again: I think/have the feeling: also your last description is not complete.

And please give a short context (so I have an idea for what/why you need this)

.

I need this not quick but thoughtful and complete..

photo
1

Dear Rami,

This is same requirement as in question but explain differently. So, you can understand the situation. Pls see attached.

1. I need negative x and y axes label in which i can add font style ad size, font style and size

2. Numbers of the axes font style and size.

photo
1
  1. And what is with the click?
  2. And what is with the positive axis labels (need or not need has size and style or not)?
  3. And what mean the marked numbers y(+4) and x(+1) on the draw?
  4. All numbers of the axis has the same style and size ?
  5. I think the vector in the draw is mathematically not correct, you want this and why?
  6. In what context you want use this? (Note: I want know this really, about 1 to 3 sentences) (Example: In the text to this applet I want explain ........for this I need......)

photo
1

Pls see attached.

  1. And what is with the click? (Click may be enable/disable the all the script to default.)
  2. And what is with the positive axis labels (need or not need has size and style or not)? (I write latex in LABEL option of positive x , y axes its worked. It is better if x,-x worked separately and y and -y for font style and size.)
  3. And what mean the marked numbers y(+4) and x(+1) on the draw? (Nothing special. Just want all numbers on number line whether x , y need font style and size to be adjusted.)
  4. All numbers of the axis has the same style and size ? (yes.)
  5. I think the vector in the draw is mathematically not correct, you want this and why? (number line vector are available in "Line Style" option. If it is need to script separately you know better.)
  6. In what context you want use this? (Note: I want know this really) ( In classroom on projector numbers on number line look so small not easy to read. )

photo
2

OK:

Use the sample here.

If necessary: change the propierties as describet in the sample

Set the 2 check-boxes off and hide (or or change the using in objects and delete checkboxes)

Create 4 points (hidden) -> (x(Corner(1)),0) , (x(Corner(2)),0), (0, y(Corner(1))), (0, y(Corner(3)))

Change the 2 vectors and make 4 using above Points and (0,0)

Andjust to above points the label-texts (created with Text-Editor and use laTex and/or properties you want) use the propertiy "position"

Create a checkbox "hide individual axis" and click to all objects you want hide with this checkbox (you can do this only 1 time, when you create the checkbox, see GGB-manual). The result is in properties Advanced by the clicked objects, there you can make corrections.

If you have problem: ask. I will answer with text (not with code)

Make the changes first in the sample, so you can send your actual state together with the questions.

photo
1

I am trying my best ...

photo
1

Andjust to above points the label-texts (created with Text-Editor and use laTex and/or properties you want) use the propertiy "position"

"Where to write latex command for number font style and size"

photo
2

you can change in XNumb and YNumb and txtSmple in properties "Text"

size, serif, bold, cursive, rounding and the color in the tab "color"

what you need more?

photo
1

Thanks rami. It serves best same as you.

It is more flexible if i can write latex for font like mathtt , mathfrak , mathcal etc.. and adjust the font size by command \scalebox{}{} ,

Also label negative x and y axis.

photo
1

Text(TableText({{If(n ≟ 0, "", "" + ((n + 0) If(flipX, -1, 1))), " "}}, "vc")

Here (obove bold) you can insert, but it's not easy, you must understand concatenated string commands.

I mean this can't be priority one right now. If everything else stands, then maybe.

I for my part only use laTex when there is no other way.

photo
2

Fine , It's OKAY. Thanks rami for the support. I have learnt so many things about software from you and your team. First i tried to solve the problem by my own. When it looks difficult then i post the question.

I must interested to know how can you write long commands, how you have learned about software.

photo
1

Hello,

pls also suggest for symbol for x,y positive and negative axes.

photo
1

What do you understand by "symbol", where should it be displayed.

How will the icons (in a particular view) differ.

Please make a sketch.

photo
1

Pls see attached. Negative x -axis left corner of horizontal axis. Positive x-axis on right.

Negative y-axis bottom corner at the vertical axis line and positive y-axis on upper.

photo
1

Symbol = Axix-Label? = 4 textes at feet/head of axis-vectors?

photo
1

Symbol = Axix-Label? = 4 textes at feet/head of axis-vectors?

Pls explain again. I did not understand what you are asking.

May be you asked position of symbol on axis. On horizontal axis above . On vertical axes right side.

photo
1

If you mean with symbol the axis label then you can use the attachment.

Otherwise explain what you mean with the word "symbol". And if I understand without further inquiry I will answer.

photo
3

improved

photo
1

The attachment is correct Pls make it for all 4 direction of axes. I have made for other axes using your command.

You frequently used pixX and pixY, What is the purpose of using this command?

photo
1

pixX = length of one pixel on the screen, depending zooming (I think I answer this earlier, but I can't find)

quote: "Pls make it for all 4 direction of axes"

sorry NO :-)

I am, like you, also too lazy :-) :-) :-)

over and out.

photo
1

rami..! i trained by you. So, i have already made it.

(I am, like you, also too lazy) No i tried i am not.. and i am successfully done. I always tried

pixX = length of one pixel on the screen, depending zooming "Yes but how it is working. i cut down this command but still found no meaning from this."

photo
1

hello rami thanks for the support. Pls see attached. I have made it for both graphics 1 & 2. and for all direction of axes . In which size of the window does not effect.

photo
1

For me all is correct (regarding axis label)

(only for more nice: the left shift from positve X-axis-label in Graphics1 must be -80pixels)

The label disappears outside the windows when the axis is outside the windows. This is because the label is bound to the axis (rightly) and not to the windows. When you move the origine near top left then the axis and the labels disapears later, when you shrink the window.

This is maybe the answer to you feedback to my question below.


  1. What you mean with: "In which size of the window does not effect"?

.

Note: The global option Font-size must be 16pt. If you want change this parameter later in a dynamic way, then the solution is more complex. The alternative is: change Fontsize then change also pixel-shift.

My suggestion: You learn to master this aspect now, then the rest of the project is easier to understand (numbers on axes)

photo
1

The label disappears outside the windows when the axis is outside the windows

"You are right rami. Is it possible to keep labels within window whether origin within the window or outside."

photo
1

Yes.

Principle using the example of X-Label right.


  1. If the Y-value of the origin is smaller than the Y-value of Corner1, then the Y-value of Corner1 applies instead of the Y-value = 0
  2. If the Y-value of the origin is biger than the Y-value of Corner3 - nPixel, then the Y-value of Corner3-nPixel applies instead of the Y-value = 0 (Note: -nPixel concerns the font height)

This would look like the following (not tested)

text1 = Text(".....", (x(Corner(2)), If(<cond1>, <val1>, If(<cond2>, <val2>,0))) + (-70pixX, 30pixY), true, true)

Test it, if you can't get it to work, please with explanations (How, What, Where, Why) and the current status as GGB.

And please don't rule out the possibility that I too could make a mistake

photo
1

now I try too.

Sorry something in my description is wrong because the values of origine are allway 0!!!

So the condition must can be:

  1. if y(Corner(1) >0 then Y-value of Corner1
  2. if y(Corner(3)-nPixel < 0 then Y-value of Corner3-nPixel

this I test and works in y-Value for text1

If(y(Corner(1)) + 20pixX > 0, y(Corner(1)) + 20pixX, If(y(Corner(3)) - 50pixX < 0, y(Corner(3)) - 50pixX, 0))

--------------------------------------------------------

Note: If I think about it again and more accurately then the description in the previous post is also correct and has the same result. This version has only shorter code. Instead of y(O) you can write a (very) little bit shorter: 0, because y(O) is always == 0.

photo
1

hello rami,

Following command not working there is some syntax error. I used this command between Text("Text", if command , true, true)

If(y(Corner(1)) + 20pixX > 0, y(Corner(1)) + 20pixX, If(y(Corner(3)) - 50pixX < 0, y(Corner(3)) - 50pixX, 0))

photo
1

see object text1

photo
1

Here is a shorter version.

Instead of nested If() its use the commands Min() and Max()

.

text1 = Text("\text{\textit{\scalebox{1.2}{\red{\textbf{x-axis}}}}}",

(x(Corner(2)), Min(Max(y(Corner(1, 2)) + 20pixX, 0), y(Corner(1, 3)) - 50pixX))

+ (-80pixX, 30pixY), true, true)

photo
1

hello rami,

Give me your brain... and experience. I have a lot of lot of things pending to animate and project with very busy schedule.

photo
1

OK

Without learning lessons. Simply to use. (a new version with a different principle)

It still needs to be adapted. Please tell me what you want to adapt (for sure the text with label).

I will execute it and send it to you.


Note:

The labels disappear when the axis with the corresponding sign is outside the window.

The Y-labels move horizontally so that no overlapping of the texts in the corner points occurs.


The oversized nesting is largely eliminated. Of course, more objects have been created.

photo
1

I am out of city heavily busy in work. But still talking to you . and thinking about my projects and learning more and more. (I need to learn lessons this is the only way to understand GGB and other related softwares they are approx similar.)

As much time permit i tried to unlock your commands meaning even during travelling. and i amazed (you use GGB for the purpose which i need and making commands) with your ideas to solve the underlying problems.


I will execute it and send it to you. "No.. I am interested in learning lesson. Or if you like you can come private for long discussions. to tell me how to make commands. "


Problem is that most of the time you understand other way whatever i said. Because, wordings can not explain the real expressions ..like.. (OK

Without learning lessons. Simply to use.)

photo
photo
3

New Version x-y-LabelAxis _12

What is new:


  • Insert in a existing Applet possible with GGB 5.0
  • Change Label-Content (laTex) , Change scaleBox, Change GGB-Option Fontsize including correction of all (internal) pixel-Values per script
  • uniform Object-Labels with documentation

.Instruction for Insert in a existing applet

  • save/copy the applet you want complete with axis-labels with new name
  • Open the Applet in GGB 5.0
  • Menue: View Graphic-1=ON and make it as active View (click in Grapfic)
  • Set GGB-Option: Font-Size = 16
  • Menue; File / Open... / filename= x-y-Axis _12 Chose File-of-type = Insert-File (.ggb)
  • click Open
  • click to button "Scan all given....."
  • change scaleBox (slider)
  • click to the Labels in the Graphic (x-axis, y-axis, -x, -y) and change the content (laTex) in InputLine-Box
  • cklick to button Scan
  • If finish:

    - bring back the GGB-option Font-Size

    - click to button "Scan all given...."

    - click to the Check-Box "development" = OFF (Top-Left)


  • Hide the Check-Box development in the Algera-View
  • Save-AS the Applet with new Name

Restrictions

  • the Axis-Ratio must be 1:1 and fixed
  • Only for Graphic-1 (later, when all is OK: also for Graphic-2)
  • Change nothing inside the code its sensible use it as Black-Box (all objects with Suffix _1)


My planing next Steps

  • Implement your change-wishes
  • If possible: Import-Script (instead insert with GGB 5.0)
  • Possibility to import also in Graphic-2


Your task

  1. check the applet direct with the File x-y-Axis _12 (without Insert in an existing Applet)
  2. check the insert in a existing applet (important: save the applet before!!!!! with sep. Filename)
  3. ask is something not clear (only handling, not questions to "how" or code)
  4. Send your change-wishes and error reports to me or (maybe) only OK (so I know I can work to the next steps)


-----------------------------------------------------------------------------------

Notes to your sample "x-y negative axes" (only as comment)


  • I think the axis vectors MUST go from low to high (all other is confusing)
  • I think f(x) for labels y-Axis is exotic
  • I think \Overline instead of "-" (minus) is wrong

photo
1

Hello rami,

I have checked your applet. It is superb.

---------------------------------------------------------------------------

Notes to your sample "x-y negative axes" (only as comment) "It is all convention/representation of axes direction opposite, label of negative axis \overline{x} and f(x) is math way and writing y-axis. It is fine"

------------------------------------------------------------------------------

Question : Why you restrict me to ask questions? I want to improve applet with you , code with you.

Pls see attached problem with labels of y-axis. It goes far from axis when drag y-axis at the corners.

photo
1

I see the y-Axis is something wrong, thanks for error-report.

(sure, error reports reports are not restricted)

Question: you change something more then the axis vectors ?

.

Note: to the resticted questions: Now, when I am coding I don't want explain the code. (for example for what is the object xy, why its in the object xy no sign etc..). Later before the code is released, then we can/should talk about it.

photo
1

Question: you change something more then the axis vectors ?

"Because i changed where i observed it required also trying to understand your commands"

photo
1

Sorry, simple question:

What did you change (besides the vectors)?

so not: why for what or because. Just WHAT: e.g. nothing, I don't know i think nothing , not shure maybe xyz.. etc.

photo
1

What did you change (besides the vectors)?

(I have increased sliders value which change position of y-axis label left/right. and direction of vectors)

photo
1

OK,

I found it: all L1Bx,

Question: Maybe soething more?

Now the question: WHY

for example: try to go more to the side of window. Or: only for wondering/try etc

(these could (need not) be indications of something else, see next point)

What is more important: What is not nice for you? What you want change if possible?

The moste important rule by testing: NOBODY is guilty.

photo
1

rami you are software scientist. You think deep in problems and always trying to solve the problem. This is always good for me to have better solution.

Which is good for me and may be for others. if next version GGB have these option built-in.

photo
1

OK

I state: For you the current version is OK.

So I will continue to work on it (as descripted above)

  • Possibility to import also in Graphic-2
  • If possible: Import-Script (instead insert with GGB 5.0)

This need time, about 3 calendar days (because I'm partially absent)

photo
1

This need time, about 3 calendar days (because I'm partially absent)

8-< (Why it will take 3 days)?

I state: For you the current version is OK. "Yes it is good"

photo
1

Because I'm partialy absent. And because I'm old enough (experienced enough) to make a realistic estimate. I expect problems when rooting the objects to Graphic1 exor 2, maybe need partial JS.

photo
1

I'm partially absent.

8=<>

8-( )

photo
1

Sorry in emotics I'm not an expert (I use them extremely rarely). I only know three :smile: and :wink: and :frowning:

But whenever possible I use language to express something. Emotics is something for people with speech disabilities :wink:

or better expressed:

exaggerated and not really seriously meaning: emotics are something for speech disabilities people. But deep in my heart I silently think for myself: one could leave out the first part of the phrase.

photo
1

Do you have experience in JS.

photo
1

No, not really.

Sorry now I want work.

Over.

photo
1

Sorry now I want work.

....SURE....

photo
1

Hello rami,

Problem is also found in negative x-axis when zoomin label goes to the origin.

photo
photo
3

Here the new version "x-y-LabelAxis _15.ggb"

What is new:

  • The objects are generated inside a exist Applet
  • All generated objects can be delete without the rest in the Applet.
  • the generator part can change

Restrictions

This Version works only for Graphic-1

The generator change the views (workaround)

Installation

  • Open the applet (following named APP) in which the commands for the axis labels are to be generated.
  • Save APP under a new name
  • Open "x-y-LabelAxis _15.ggb" (following named LAB)
  • Open in LAB global Javascript (right click on any object in the AlgebraView, Properties/Scripts/global JS)
  • copy all in the script editor
  • Open in APP global Javascript
  • Mark all in the scirpt editor from APP
  • Insert (ctrl-V) (move all lines from global JS LAB to APP)
  • close LAB (not save)
  • Save APP (explicite in the menue)
  • close APP
  • open APP
  • now all needed objects are generated.

change the content or format of axisLabel

  • open APP
  • open AlgeraView
  • rightclick on L1XR1t1or L1XL1t1 or L1YT1t1 or L1YB1t1 then
  • properties / Basic then change the latext-string

change the size of axisLabel

  • open APP
  • unHide the object scaleBox1
  • shift the slider (between 0.8 and 2.0)
  • hide scaleBox1

Remove axis Label in APP

  • open APP
  • open AlgebraView
  • delete the object mit name "deleteMeThenDeleteAllAxisLabel1"
  • open global JS
  • delete all lines in the script-editor of global JS

Reinstallation axisLabel (for example something is destroyed)

  • open App
  • delete the object mit name "deleteMeThenDeleteAllAxisLabel1"
  • close App
  • open App

===========================================

  1. please test above
  2. report Bug's or create Change requests
  3. Questions (I will not answer questions about JS)

====================================

photo
1

Hello rami,

Great work... When zoomin negative x-axis goes to the origin.

3. Questions (I will not answer questions about JS) ( :-# )

photo
1

ZoomIn and similar commands are fully asynchronized with the rest of the processing.

This over many GGB processing cycles. GGB uses this to create a smooth motion.

This means that ZoomIn command family can not be used simultaneously with calculations of screen positions. This is not a problem within axisLabel but a general problem

But I also think that the GGB team would classify that as a restriction rather than a bug.

In the attachment a partial workaround for this problem.

Whenever you want to use a ZoomIn family command, subsequent errors may disappear when you implement the workaround. Or you can choose not to use tthe ZoomIn family commands.

photo
1

Why you used JS in this applet rather than GGB script any special reason.

photo
2

I also had a version with GGB script.

I have discarded this version, because the installation was too complicated for the user.


3 objects and their scripts had to be installed. The uninstallation required one more object with script.

In this version, copying is done once and no objects are created manually.

photo
1

Means, you also having experience in JS.

What is the difference in global JS (which used in GGB) and JS.

And i have observed that , you used all GGB script commands in this Applet of Global Script tab.

photo
1

What is the difference....

same syntax, limited possibilities. Note: this was a question to JS.

And i have observed that......

Yes with the ggbApplet-Interface evalCommand() all ggb-commands are available. Whenever possible I use evalCommand().

Note: This was not a question but a (correct) statement on your part about the topic JS

------------------

If your appointments with your customer are important to you, then I recommend you not to look after JS.

photo
1

I recommend you not to look after JS.

(What is after JS?

If i am curious about things why i can not learn.

Now i am spending a lot of time (as much i can steal from the day) with GGB manual as you said and i have learnt many things.)

Let me tell you one thing "rami" about my favorite (due to story or message in the story) movie "Cars-3" by Pixar Animation. The story of this movie is also applicable to you might be... hopefully..

photo
© 2020 International GeoGebra Institute