{"id":1960,"date":"2023-09-08T02:55:56","date_gmt":"2023-09-08T09:55:56","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=1960"},"modified":"2023-09-22T20:28:22","modified_gmt":"2023-09-23T03:28:22","slug":"390-protractor-image-using-tikz-package-in-latex","status":"publish","type":"post","link":"https:\/\/gantovnik.com\/bio-tips\/2023\/09\/390-protractor-image-using-tikz-package-in-latex\/","title":{"rendered":"#390 Protractor image using tikz package in LaTeX"},"content":{"rendered":"<p><a href=\"https:\/\/gantovnik.com\/bio-tips\/2023\/09\/390-protractor-image-using-tikz-package-in-latex\/ex390\/\" rel=\"attachment wp-att-1961\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/09\/ex390.png?resize=1080%2C586&#038;ssl=1\" alt=\"\" width=\"1080\" height=\"586\" class=\"alignnone size-full wp-image-1961\" srcset=\"https:\/\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/09\/ex390.png 1892w, https:\/\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/09\/ex390-1280x694.png 1280w, https:\/\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/09\/ex390-980x531.png 980w, https:\/\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/09\/ex390-480x260.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) and (max-width: 1280px) 1280px, (min-width: 1281px) 1892px, 100vw\" \/><\/a><\/p>\n<p>I converted pdf to png using program ImageMagick with the following parameters:<\/p>\n<p>bat script:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nmagick -density 400 -quality 100 -colorspace sRGB ex390.pdf ex390.png\r\n<\/pre>\n<p>LaTeX script:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n\\documentclass{standalone}\r\n\\usepackage{tikz}\r\n\\usepackage{ifthen}\r\n\\usepackage{intcalc}\r\n\\begin{document}\r\n\t\\begin{tikzpicture}\r\n\t\t\\draw (6,0) arc &#x5B;radius=6, start angle=0, end angle=180] -- (-6,-0.5) -- (6,-0.5) -- cycle;\r\n\t\t\\foreach \\i in {0,10,...,180}{\r\n\t\t\t\\draw&#x5B;red] (\\i:5.2) -- (\\i:6);\r\n\t\t\t\\node&#x5B;red, rotate=-90+\\i] at (\\i:5) {\\i};\r\n\t\t\t\\node&#x5B;rotate=90-\\i] at (180-\\i:4.5) {\\i};\r\n\t\t\t\\draw (\\i:1) -- (\\i:3);\r\n\t\t}\r\n\t\t\\foreach \\i in {0,1,...,180}{\r\n\t\t\t\\ifthenelse{\\intcalcMod{\\i}{10}=0}{\r\n\t\t\t\t}{\r\n\t\t\t\t\\ifthenelse{\\intcalcMod{\\i}{10}=5}{\r\n\t\t\t\t\t\\draw&#x5B;blue] (\\i:5.4) -- (\\i:6);\r\n\t\t\t\t}{\r\n\t\t\t\t\t\\draw (\\i:5.6) -- (\\i:6);\r\n\t\t\t\t}\t\r\n\t\t\t}\r\n\t\t}\r\n\t\t\\draw&#x5B;-&gt;, line width=1] (0,0) -- (4,0);\r\n\t\t\\draw&#x5B;-&gt;, line width=1] (0,0) -- (0,4);\r\n\t\t\\draw&#x5B;-&gt;, line width=1] (0,0) -- (-4,0);\r\n\t\t\\filldraw&#x5B;fill=white] (0,0) circle &#x5B;radius=0.2] node {+};\r\n\t\\end{tikzpicture}\r\n\\end{document}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I converted pdf to png using program ImageMagick with the following parameters: bat script: magick -density 400 -quality 100 -colorspace sRGB ex390.pdf ex390.png LaTeX script: \\documentclass{standalone} \\usepackage{tikz} \\usepackage{ifthen} \\usepackage{intcalc} \\begin{document} \\begin{tikzpicture} \\draw (6,0) arc &#x5B;radius=6, start angle=0, end angle=180] &#8212; (-6,-0.5) &#8212; (6,-0.5) &#8212; cycle; \\foreach \\i in {0,10,&#8230;,180}{ \\draw&#x5B;red] (\\i:5.2) &#8212; (\\i:6); \\node&#x5B;red, rotate=-90+\\i] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_lmt_disableupdate":"yes","_lmt_disable":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[35],"tags":[],"class_list":["post-1960","post","type-post","status-publish","format-standard","hentry","category-latex"],"modified_by":"gantovnik","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8bH0k-vC","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1002,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/10\/180-linear-regression-using-python\/","url_meta":{"origin":1960,"position":0},"title":"#180 Linear regression using python","author":"gantovnik","date":"2021-10-26","format":false,"excerpt":"[code language=\"python\"] import os import matplotlib.pyplot as plt import numpy as np import seaborn as sns from sklearn.linear_model import LinearRegression sns.set() os.chdir(r'D:\\projects\\wordpress\\ex66') os.getcwd() rng = np.random.RandomState(1) x = 10 * rng.rand(50) y = 2 * x - 5 + rng.randn(50) plt.scatter(x, y) model = LinearRegression(fit_intercept=True) model.fit(x[:, np.newaxis], y) xfit =\u2026","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/10\/ex180.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/10\/ex180.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/10\/ex180.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":525,"url":"https:\/\/gantovnik.com\/bio-tips\/2020\/05\/tcl-script-that-prompts-the-user-to-select-nodes-and-displays-their-x-y-and-z-coordinates\/","url_meta":{"origin":1960,"position":1},"title":"Tcl script that prompts the user to select nodes and displays their x, y and z coordinates","author":"gantovnik","date":"2020-05-06","format":false,"excerpt":"Tcl script that prompts the user to select nodes and displays their x, y and z coordinates: [code language=\"python\"] #An example is a Tcl script that prompts the user to select nodes #and displays their x, y and z coordinates: hm_markclear nodes 1 *createmarkpanel nodes 1 set nodes [hm_getmark nodes\u2026","rel":"","context":"In &quot;tcl&quot;","block_context":{"text":"tcl","link":"https:\/\/gantovnik.com\/bio-tips\/category\/tcl\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2017,"url":"https:\/\/gantovnik.com\/bio-tips\/2024\/01\/402-find-edge-nodes-of-mesh-and-create-node-sets-for-each-edge-using-tcl-script-in-hypermesh\/","url_meta":{"origin":1960,"position":2},"title":"#402 Find edge nodes of mesh and create node sets for each edge loop using tcl script in HyperMesh","author":"gantovnik","date":"2024-01-07","format":false,"excerpt":"Assume we have this model: The script will find all edges and create set of nodes for each edge: [code language=\"python\"] *clearmark comps 1 *clearmark elems 1 *createmark elems 1 \"by comps\" 1 # hm_getedgeloops = Returns surface and element entities of specific connection types. # looptype=2 get all closed\u2026","rel":"","context":"In &quot;HyperMesh&quot;","block_context":{"text":"HyperMesh","link":"https:\/\/gantovnik.com\/bio-tips\/category\/hypermesh\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/01\/ex402_3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/01\/ex402_3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/01\/ex402_3.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2140,"url":"https:\/\/gantovnik.com\/bio-tips\/2024\/02\/417-polar-plot-using-sympy-plotting-functions-in-python\/","url_meta":{"origin":1960,"position":3},"title":"#417 Polar plot using SymPy plotting functions in python","author":"gantovnik","date":"2024-02-21","format":false,"excerpt":"[code language=\"python\"] import matplotlib.pyplot as plt from sympy import symbols, sin, cos, pi, latex from spb import plot_polar x = symbols(\"x\") expr = sin(2 * x) * cos(5 * x) + pi \/ 2 plot_polar(expr, (x, 0, 2 * pi), polar_axis=True, ylim=(0, 3), title=\"$%s$\" % latex(expr)) plt.savefig(\"ex417.png\", dpi=100) plt.show() [\/code]","rel":"","context":"In &quot;matplotlib&quot;","block_context":{"text":"matplotlib","link":"https:\/\/gantovnik.com\/bio-tips\/category\/matplotlib\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/02\/ex417.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/02\/ex417.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/02\/ex417.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/02\/ex417.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":2032,"url":"https:\/\/gantovnik.com\/bio-tips\/2024\/01\/403-get-nodes-for-all-elements-in-the-fem-model-in-hypermesh-using-tcl-script\/","url_meta":{"origin":1960,"position":4},"title":"#403 Get nodes for all elements in the FEM model in HyperMesh using tcl script","author":"gantovnik","date":"2024-01-13","format":false,"excerpt":"ex403.tcl [code language=\"python\"] set script_path [ file dirname [ file normalize [ info script ] ] ] puts $script_path cd $script_path pwd *createmark elems 1 all set elemList [ hm_getmark elements 1 ] *clearmark elements 1 set outfile [open \"ex403.txt\" w] foreach elem_id $elemList { # Get the list of\u2026","rel":"","context":"In &quot;HyperMesh&quot;","block_context":{"text":"HyperMesh","link":"https:\/\/gantovnik.com\/bio-tips\/category\/hypermesh\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1733,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/12\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-2-2-2-2-2-2-2-2-2-3-2-2-2-2-2-2-2-2-2-2-4-2\/","url_meta":{"origin":1960,"position":5},"title":"#328 Add labels with node coordinates using HyperMesh Tcl","author":"gantovnik","date":"2022-12-14","format":false,"excerpt":"nodes.txt [code language=\"python\"] 3.3 10 3 1.4 6 0 2.6 7 4 8.5 10 9 0.3 2 2 6.4 6 10 1.1 5 7 5.7 3 3 0.6 8 9 1.4 0 6 [\/code] create_nodes.tcl [code language=\"python\"] set script_path [ file dirname [ file normalize [ info script ] ]\u2026","rel":"","context":"In &quot;HyperMesh&quot;","block_context":{"text":"HyperMesh","link":"https:\/\/gantovnik.com\/bio-tips\/category\/hypermesh\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/12\/ex328.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/12\/ex328.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/12\/ex328.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1960","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/comments?post=1960"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1960\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=1960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=1960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=1960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}