JuliaGraphics / Luxor.jl

Simple drawings using vector graphics; Cairo "for tourists!"
http://juliagraphics.github.io/Luxor.jl/
Other
588 stars 71 forks source link

Update graphdemo.jl #279

Open StevenSiew opened 11 months ago

StevenSiew commented 11 months ago

1) Update formatting of module luxorgraphtools by indenting module source code

2) add minorticks feature to function lit_create_graph_xticks and function lit_create_graph_yticks

3) add more arrow functions lit_graph_arrow_text_cart_W lit_graph_arrow_text_cart_NW lit_graph_arrow_text_cart_SW

4) add more arrows to the graph

""" Draw Arrow for (cos(π x) - sin(2x)) exp(-0.2x) """
xvalue = 3.6
xcoor = lit_convert_graph_xvalue_to_cart_xcoor(canvasconfig,xvalue,xlims,myplottingarea)
yvalue = -1 * (sin(2 * xvalue) + cos(pi * xvalue)) * exp(-0.2 * xvalue)
ycoor = lit_convert_graph_yvalue_to_cart_ycoor(canvasconfig,yvalue,ylims,myplottingarea)
lit_graph_arrow_text_cart_W("(cos(π x) - sin(2x)) exp(-0.2x)",xcoor,ycoor)

""" Draw Arrow for cos(x) """
xvalue = 4.9
xcoor = lit_convert_graph_xvalue_to_cart_xcoor(canvasconfig,xvalue,xlims,myplottingarea)
yvalue = cos(xvalue)
ycoor = lit_convert_graph_yvalue_to_cart_ycoor(canvasconfig,yvalue,ylims,myplottingarea)
lit_graph_arrow_text_cart_NW("cos(x)",xcoor,ycoor,arrow_length=40)

""" Draw Arrow for sin(x) """
xvalue = 3.1
xcoor = lit_convert_graph_xvalue_to_cart_xcoor(canvasconfig,xvalue,xlims,myplottingarea)
yvalue = sin(xvalue)
ycoor = lit_convert_graph_yvalue_to_cart_ycoor(canvasconfig,yvalue,ylims,myplottingarea)
lit_graph_arrow_text_cart_SW("sin(x)",xcoor,ycoor,arrow_length=40,horizontal_length=20)

5) update calling xticks and yticks to set minorticks flag to true

    lit_create_graph_xticks(0:1:6,xlims,myplottingarea,minortick=true)
    lit_create_graph_yticks(-1.2:0.2:1.2,ylims,myplottingarea,minortick=true)
codecov[bot] commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 74.45%. Comparing base (65e5e87) to head (16ff49a). Report is 69 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #279 +/- ## ======================================= Coverage 74.45% 74.45% ======================================= Files 35 35 Lines 6701 6701 ======================================= Hits 4989 4989 Misses 1712 1712 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

hyrodium commented 11 months ago
  1. Update formatting of module luxorgraphtools by indenting module source code

Note that most Julia script does not indent the body of the module.

The recommended style is not to indent the body of the module, since that would typically lead to whole files being indented.

https://docs.julialang.org/en/v1/manual/modules/

cormullion commented 11 months ago

In theory, if you change the code so that the output looks different, you should probably also update the output file (in docs/src/assets/figures/, because it's not run automatically. But I don't think it's strictly necessary in this case before the PR can be merged.

StevenSiew commented 11 months ago

Sorry. Originally the module itself is in another file but I rather have only one file instead of two separate files. On it's own file, I have always indented the contents of the module so I guess that I have mess up.

Also, please run the file and update the SVG file in in docs/src/assets/figures/ This will also check that the source file is correct and does generate the NEW diagram of the plot.

stale[bot] commented 6 months ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.