# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=350

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 351

---

## [In vscode, is there a way to show snippets of function of python package when called by PythonCall.jl or PyCall.jl?](https://discourse.julialang.org/t/in-vscode-is-there-a-way-to-show-snippets-of-function-of-python-package-when-called-by-pythoncall-jl-or-pycall-jl/92224)

<div class="topic-metadata">

**Author:** [@YH\_Ko](https://discourse.julialang.org/u/YH_Ko)\
**Replies:** 0\
**Last updated:** [December 28, 2022, 11:53am UTC](https://discourse.julialang.org/t/in-vscode-is-there-a-way-to-show-snippets-of-function-of-python-package-when-called-by-pythoncall-jl-or-pycall-jl/92224 "2022-12-28T11:53:47Z")

</div>

Hi all. I’m trying to use Python’s matplotlib package in Julia code. It is called by PythonCall.jl. In vscode, Is there a way to show snippets of functions (ex. plt.plot(), plt.xlabel …etc) of python package when cal…

---

## [How to implement One-Vs-Rest for Multi-Class Classification?](https://discourse.julialang.org/t/how-to-implement-one-vs-rest-for-multi-class-classification/92191)

<div class="topic-metadata">

**Author:** [@skalarr](https://discourse.julialang.org/u/skalarr)\
**Replies:** 3\
**Last updated:** [December 28, 2022, 10:34am UTC](https://discourse.julialang.org/t/how-to-implement-one-vs-rest-for-multi-class-classification/92191 "2022-12-28T10:34:51Z")

</div>

Greetings, I’m new to Julia and i am trying to implement One-Vs-Rest Multi-Class Classification, and I was wondering if anyone could help me out. Here is a snippet of my code so far: My data frame is basic since I’m try…

---

## [How to Reflect the Curve toward $y$ axis with Plots?](https://discourse.julialang.org/t/how-to-reflect-the-curve-toward-y-axis-with-plots/92209)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 7\
**Last updated:** [December 28, 2022, 9:15am UTC](https://discourse.julialang.org/t/how-to-reflect-the-curve-toward-y-axis-with-plots/92209 "2022-12-28T09:15:23Z")

</div>

Hi all, I have a code from previous forum, it is a reflection toward x axis, then I want to reflect my curve toward y axis, but I am unable to do so, this is the code: using Plots, LaTeXStrings, Plots.PlotMeasures gr()…

---

## [How to set the julia optimization level for each run on Github Actions?](https://discourse.julialang.org/t/how-to-set-the-julia-optimization-level-for-each-run-on-github-actions/92212)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 0\
**Last updated:** [December 28, 2022, 8:00am UTC](https://discourse.julialang.org/t/how-to-set-the-julia-optimization-level-for-each-run-on-github-actions/92212 "2022-12-28T08:00:31Z")

</div>

I have this script, where I have the following matrix: matrix: julia-version: \['1', '1.6', '~1.9.0-0'\] and the following command to launch julia shell: julia --color=yes --project=downstream {0} I wan…

---

## [Force recompiling functions in conditional compilation](https://discourse.julialang.org/t/force-recompiling-functions-in-conditional-compilation/92132)

<div class="topic-metadata">

**Author:** [@jsjie](https://discourse.julialang.org/u/jsjie)\
**Replies:** 1\
**Last updated:** [December 27, 2022, 10:43pm UTC](https://discourse.julialang.org/t/force-recompiling-functions-in-conditional-compilation/92132 "2022-12-27T22:43:37Z")

</div>

I want to do conditional compilation. Besides, when developing, I’d like to be able to exam all branches. Can I do that? An explanation by case: My code will have two different modes when used in production, let’s call…

---

## [Why isn't there @\_\_FUNCTION\_\_?](https://discourse.julialang.org/t/why-isnt-there-function/92198)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 1\
**Last updated:** [December 27, 2022, 8:49pm UTC](https://discourse.julialang.org/t/why-isnt-there-function/92198 "2022-12-27T20:49:06Z")

</div>

Is there an alternative?

---

## [How to fit a polynomial with a pre-determined degree to a set of points?](https://discourse.julialang.org/t/how-to-fit-a-polynomial-with-a-pre-determined-degree-to-a-set-of-points/91981)

<div class="topic-metadata">

**Author:** [@Hugo](https://discourse.julialang.org/u/Hugo)\
**Replies:** 7\
**Last updated:** [December 27, 2022, 7:44pm UTC](https://discourse.julialang.org/t/how-to-fit-a-polynomial-with-a-pre-determined-degree-to-a-set-of-points/91981 "2022-12-27T19:44:06Z")

</div>

Hi, all I want to approximate a function to a vector v of 99 values so I can evaluate that function over other values. This can be a simple linear interpolation of the 99 values, but I’d fit a polynomial in case other v…

---

## [Interpolations.jl: different fill values left and right for FillExtrapolation](https://discourse.julialang.org/t/interpolations-jl-different-fill-values-left-and-right-for-fillextrapolation/92193)

<div class="topic-metadata">

**Author:** [@tom-plaa](https://discourse.julialang.org/u/tom-plaa)\
**Replies:** 4\
**Last updated:** [December 27, 2022, 7:35pm UTC](https://discourse.julialang.org/t/interpolations-jl-different-fill-values-left-and-right-for-fillextrapolation/92193 "2022-12-27T19:35:34Z")

</div>

Is it possible to select different fill values for left and right for extrapolation? For example, imagine I want the interpolation object to return 0 when to left of the minimum existing value in the grid and 1 when it’…

---

## [How to Create Bone of Cylinder with Ellipse with Plots / PlotlyJS?](https://discourse.julialang.org/t/how-to-create-bone-of-cylinder-with-ellipse-with-plots-plotlyjs/92181)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 3\
**Last updated:** [December 27, 2022, 3:12pm UTC](https://discourse.julialang.org/t/how-to-create-bone-of-cylinder-with-ellipse-with-plots-plotlyjs/92181 "2022-12-27T15:12:41Z")

</div>

Hi all, I have created the left side of the picture: with this code: using Plots, LaTeXStrings, Plots.PlotMeasures gr() f(x) = sqrt(x) plot(f,0,4, xtick=0:4:4, xlims=(0,6), ylims=(0,3), framestyle=:zerolines, bo…

---

## [Tullio and the nograd option](https://discourse.julialang.org/t/tullio-and-the-nograd-option/92123)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 13\
**Last updated:** [December 27, 2022, 2:33pm UTC](https://discourse.julialang.org/t/tullio-and-the-nograd-option/92123 "2022-12-27T14:33:56Z")

</div>

@ChrisRackauckas , @mcabbott, I have a Tullio expression: Poly(coef) = @tullio poly\[i\] := coef\[j\] \* x\[i\]^I\[j\].x \* y\[i\]^I\[j\].y grad=Dual nograd=x nograd=y nograd=I I assumed that the nograd option expressed that these …

---

## [How to Use InverseFunctions.jl that can Calculate the Inverse of a Function?](https://discourse.julialang.org/t/how-to-use-inversefunctions-jl-that-can-calculate-the-inverse-of-a-function/91931)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 15\
**Last updated:** [December 27, 2022, 2:46pm UTC](https://discourse.julialang.org/t/how-to-use-inversefunctions-jl-that-can-calculate-the-inverse-of-a-function/91931 "2022-12-27T14:46:38Z")

</div>

Hi all, I read the package here: https://juliamath.github.io/InverseFunctions.jl/stable/ I want to calculate simple inverse of a function: y^{2} = 4x I use this: using InverseFunctions foo(x) = sqrt(4x) inverse(fo…

---

## [Problem while precompiling Javis](https://discourse.julialang.org/t/problem-while-precompiling-javis/92055)

<div class="topic-metadata">

**Author:** [@Smettus](https://discourse.julialang.org/u/Smettus)\
**Replies:** 4\
**Last updated:** [December 27, 2022, 1:27pm UTC](https://discourse.julialang.org/t/problem-while-precompiling-javis/92055 "2022-12-27T13:27:25Z")

</div>

For a project, I need my hands on a simple, yet effective SVG/other animation package. Javis, built on top of Luxor, seemed a viable option. However, while trying to install and precompile the package, I received the fol…

---

## [Plotting a mesh with transparency with MeshViz.jl](https://discourse.julialang.org/t/plotting-a-mesh-with-transparency-with-meshviz-jl/92002)

<div class="topic-metadata">

**Author:** [@\_stla](https://discourse.julialang.org/u/_stla)\
**Replies:** 1\
**Last updated:** [December 27, 2022, 12:05pm UTC](https://discourse.julialang.org/t/plotting-a-mesh-with-transparency-with-meshviz-jl/92002 "2022-12-27T12:05:30Z")

</div>

I have a mesh made with Meshes.jl and I plot it with MeshViz.jl. There’s a alpha parameter to set the transparency. When I use it, here is the result I obtain: How to solve this issue?

---

## [How to document a method where the leading arguments are optional?](https://discourse.julialang.org/t/how-to-document-a-method-where-the-leading-arguments-are-optional/92180)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 3\
**Last updated:** [December 27, 2022, 10:55am UTC](https://discourse.julialang.org/t/how-to-document-a-method-where-the-leading-arguments-are-optional/92180 "2022-12-27T10:55:04Z")

</div>

The julia docstring convention for a function f(x,y) where the second argument is optional, is: f(x, y=1) Here 1 is the default value of the argument. This coincides nicely with the method definition. What does one do,…

---

## [How to extract sampled values from a Turing model](https://discourse.julialang.org/t/how-to-extract-sampled-values-from-a-turing-model/92157)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 1\
**Last updated:** [December 27, 2022, 9:58am UTC](https://discourse.julialang.org/t/how-to-extract-sampled-values-from-a-turing-model/92157 "2022-12-27T09:58:56Z")

</div>

I have implemented a Bayesian model and I am interested in extracting the results. I’d like to first assess convergence of the MCMC chains but also extract the values for the parameters. chain = sample(model\_fun, sample…

---

## [Faster quadratic expression for symmetric matrices](https://discourse.julialang.org/t/faster-quadratic-expression-for-symmetric-matrices/91843)

<div class="topic-metadata">

**Author:** [@corbat](https://discourse.julialang.org/u/corbat)\
**Replies:** 12\
**Last updated:** [December 27, 2022, 6:04am UTC](https://discourse.julialang.org/t/faster-quadratic-expression-for-symmetric-matrices/91843 "2022-12-27T06:04:16Z")

</div>

Hi, I have a use case where I need to evaluate many quadratic expressions of the form x^T M x, with the matrix M always beeing symmetric. The typical dimensionality of M is between 3 and 3000. Using the following two ap…

---

## [How to Animate Solid of Revolution from SemiCircle to Torus?](https://discourse.julialang.org/t/how-to-animate-solid-of-revolution-from-semicircle-to-torus/92178)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 0\
**Last updated:** [December 27, 2022, 5:41am UTC](https://discourse.julialang.org/t/how-to-animate-solid-of-revolution-from-semicircle-to-torus/92178 "2022-12-27T05:41:01Z")

</div>

Hi all, I want to know how to create animation, from semicircle become cone then torus like this? So People can imagine how it looks like. This is called Solids of Revolution: Method of Disks. When a plane region rev…

---

## [Could anyone make this run faster?](https://discourse.julialang.org/t/could-anyone-make-this-run-faster/92145)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 21\
**Last updated:** [December 26, 2022, 9:09pm UTC](https://discourse.julialang.org/t/could-anyone-make-this-run-faster/92145 "2022-12-26T21:09:38Z")

</div>

Hello! I apologize for using unicode characters before hand, but I really like it :slight\_smile: I have a function given as: function ∇ᵢWᵢⱼ(αD,q,xᵢⱼ,h) # Skip distances outside the support of the kernel: if q \< …

---

## [Improving performance: large amount of time on getindex and setindex!](https://discourse.julialang.org/t/improving-performance-large-amount-of-time-on-getindex-and-setindex/92166)

<div class="topic-metadata">

**Author:** [@james3](https://discourse.julialang.org/u/james3)\
**Replies:** 1\
**Last updated:** [December 26, 2022, 8:46pm UTC](https://discourse.julialang.org/t/improving-performance-large-amount-of-time-on-getindex-and-setindex/92166 "2022-12-26T20:46:58Z")

</div>

I am trying to improve the performance of my code. If I profile (Profile.@profile), ~40% of the time is spent on getindex and setindex!. My code is making extensive use of multidimensional arrays, which I suspect is resp…

---

## [Issues with distributed package](https://discourse.julialang.org/t/issues-with-distributed-package/92158)

<div class="topic-metadata">

**Author:** [@tomd](https://discourse.julialang.org/u/tomd)\
**Replies:** 0\
**Last updated:** [December 26, 2022, 6:14pm UTC](https://discourse.julialang.org/t/issues-with-distributed-package/92158 "2022-12-26T18:14:59Z")

</div>

Hello! I have a code which has to deal with large arrays: l = length(A) m = 56^2 flag = trues(l) flatten\_connectivity = Array{Float32, 2}(undef, l, m) for i = 1:l flatten\_connectivity\[i, :\] …

---

## [Alternate y-axis in Plotting](https://discourse.julialang.org/t/alternate-y-axis-in-plotting/92152)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 0\
**Last updated:** [December 26, 2022, 5:19pm UTC](https://discourse.julialang.org/t/alternate-y-axis-in-plotting/92152 "2022-12-26T17:19:02Z")

</div>

I am using Plots to build a plot line by line. My initial intent was to plot one line using the left y-axis and then the next line using the right y-axis. For the first time through, using twinx() works well. Howeve…

---

## [Example of hierarchical model in Turing](https://discourse.julialang.org/t/example-of-hierarchical-model-in-turing/19554)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 9\
**Last updated:** [December 26, 2022, 2:46pm UTC](https://discourse.julialang.org/t/example-of-hierarchical-model-in-turing/19554 "2022-12-26T14:46:51Z")

</div>

Hi all- I have been looking for an example of a hierarchical model in Turing.jl but have not found one. I was wondering if anyone has an example or could show me how to implement a simple example, such as a hierarchical…

---

## [CellListMap: Go from list of pairs to list of indices](https://discourse.julialang.org/t/celllistmap-go-from-list-of-pairs-to-list-of-indices/91974)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 8\
**Last updated:** [December 26, 2022, 11:30am UTC](https://discourse.julialang.org/t/celllistmap-go-from-list-of-pairs-to-list-of-indices/91974 "2022-12-26T11:30:26Z")

</div>

Hello! I am using CellListMap to generate a neighbour list of the type: ListOfPairs = (1,4,0.04) (1,3,0.02) (1,8,0.09) (2,1,0.01) (2,4,0.05) Where first index is “i”, second index is “j” and third index is the eu…

---

## [General Plotting Code for Cone in 3D with GLMakie or Plots](https://discourse.julialang.org/t/general-plotting-code-for-cone-in-3d-with-glmakie-or-plots/92104)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 3\
**Last updated:** [December 26, 2022, 10:24am UTC](https://discourse.julialang.org/t/general-plotting-code-for-cone-in-3d-with-glmakie-or-plots/92104 "2022-12-26T10:24:25Z")

</div>

Hi all, so I want to plot a general cone of pyramid and a right circular cone, I get this formula: But I think the plotting does not use the volume formula. Because of this torus code for GLMakie that I have: using …

---

## [Precompiling Plots Keeps Occuring Whenever I use Plots](https://discourse.julialang.org/t/precompiling-plots-keeps-occuring-whenever-i-use-plots/92031)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [December 26, 2022, 10:20am UTC](https://discourse.julialang.org/t/precompiling-plots-keeps-occuring-whenever-i-use-plots/92031 "2022-12-26T10:20:39Z")

</div>

Why there is Precompiling Plots now whenever I use Plots? It wasn’t like this before(2 months ago), so it takes longer to show the plot.

---

## [Color plot with a list](https://discourse.julialang.org/t/color-plot-with-a-list/91835)

<div class="topic-metadata">

**Author:** [@saba](https://discourse.julialang.org/u/saba)\
**Replies:** 6\
**Last updated:** [December 26, 2022, 7:08am UTC](https://discourse.julialang.org/t/color-plot-with-a-list/91835 "2022-12-26T07:08:11Z")

</div>

Hi I have a big list which contains some other lists. It’s for example like this A=\[ \[1,2,3\] , \[4,5,6\] , \[7,8,9\] \]. How can I plot a heatmap for this? or any other types of colormaps. My actual list information: typeo…

---

## [Makie: is it possible to draw major and minor ticks on all four axes?](https://discourse.julialang.org/t/makie-is-it-possible-to-draw-major-and-minor-ticks-on-all-four-axes/66911)

<div class="topic-metadata">

**Author:** [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Replies:** 9\
**Last updated:** [December 26, 2022, 2:20am UTC](https://discourse.julialang.org/t/makie-is-it-possible-to-draw-major-and-minor-ticks-on-all-four-axes/66911 "2022-12-26T02:20:01Z")

</div>

I can not find the solution from the doc. Note that I do not mean twin axes. I just want to pair the ticks for left and right axes, and bottom and top axes, respectively. Thanks!

---

## [Vectorization over subset of indices](https://discourse.julialang.org/t/vectorization-over-subset-of-indices/92097)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 8\
**Last updated:** [December 25, 2022, 7:30pm UTC](https://discourse.julialang.org/t/vectorization-over-subset-of-indices/92097 "2022-12-25T19:30:22Z")

</div>

I would like to vectorize some operation such as a .= b .+ c but only a subset of indices. For example, if they are both 4D arrays, I would like to vectorize only over dimensions 1 and 3. Is this possible,perhaps with…

---

## [How to Create a Ring Torus with Plots? (I have the code with GLMakie and gnuplot package that need more perfectioning)](https://discourse.julialang.org/t/how-to-create-a-ring-torus-with-plots-i-have-the-code-with-glmakie-and-gnuplot-package-that-need-more-perfectioning/92103)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [December 25, 2022, 11:04am UTC](https://discourse.julialang.org/t/how-to-create-a-ring-torus-with-plots-i-have-the-code-with-glmakie-and-gnuplot-package-that-need-more-perfectioning/92103 "2022-12-25T11:04:52Z")

</div>

Hi all, I want to create 3-dimensional torus like this: With GLMakie or Plots, because I want to add annotations, and then I can see which is x,y,z axis I get the code from Lazarus’ website using Gnuplot let U …

---

## [How to Transform Plots / Shape with Plots.jl](https://discourse.julialang.org/t/how-to-transform-plots-shape-with-plots-jl/92079)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 7\
**Last updated:** [December 25, 2022, 11:02am UTC](https://discourse.julialang.org/t/how-to-transform-plots-shape-with-plots-jl/92079 "2022-12-25T11:02:47Z")

</div>

Hi all, I want to transform the shape that I plot with this code: using Plots, LaTeXStrings, Roots, SymPy gr() f(x) = sin(x^2) + cos(2x) - 6 g(x) = sin(x^2) + cos(2x) plot(f,2,4, ylims=(-8,3), legend=:topleft, li…

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=349)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=351)
