# General Usage

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

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

**Page:** 595

---

## [How to increase plot width in Julia Plots.jl without increasing tick line width and the gap between tick and tick axis](https://discourse.julialang.org/t/how-to-increase-plot-width-in-julia-plots-jl-without-increasing-tick-line-width-and-the-gap-between-tick-and-tick-axis/61660)

<div class="topic-metadata">

**Author:** [@curious](https://discourse.julialang.org/u/curious)\
**Replies:** 12\
**Last updated:** [May 27, 2021, 12:18pm UTC](https://discourse.julialang.org/t/how-to-increase-plot-width-in-julia-plots-jl-without-increasing-tick-line-width-and-the-gap-between-tick-and-tick-axis/61660 "2021-05-27T12:18:11Z")

</div>

Hello, I want to plot many data points whose x values are very close to each other. To be able to separate them out a little more so that they can be seen more clearly, I want to increase the plot width (it can be much …

---

## [Plotting Library for Online Tutorial / Book](https://discourse.julialang.org/t/plotting-library-for-online-tutorial-book/61915)

<div class="topic-metadata">

**Author:** [@danielw2904](https://discourse.julialang.org/u/danielw2904)\
**Replies:** 0\
**Last updated:** [May 27, 2021, 12:09pm UTC](https://discourse.julialang.org/t/plotting-library-for-online-tutorial-book/61915 "2021-05-27T12:09:31Z")

</div>

I am part of the effort to recreate “Causal Inference: The Mixtape” in Julia and therefore tried a couple of plotting libraries to recreate the first plot in the book (https://mixtape.scunning.com/probability-and-regress…

---

## [Live reload API](https://discourse.julialang.org/t/live-reload-api/61908)

<div class="topic-metadata">

**Author:** [@Skoffer](https://discourse.julialang.org/u/Skoffer)\
**Replies:** 2\
**Last updated:** [May 27, 2021, 9:46am UTC](https://discourse.julialang.org/t/live-reload-api/61908 "2021-05-27T09:46:26Z")

</div>

I wonder is there any mechanism to implement live reload in case one develops REST API? As an example, consider the following code, which is defined in file “server.jl” using HTTP function hello(r) return HTTP.Res…

---

## [How avoid this Warning when I use Contour](https://discourse.julialang.org/t/how-avoid-this-warning-when-i-use-contour/61327)

<div class="topic-metadata">

**Author:** [@MillerSilva](https://discourse.julialang.org/u/MillerSilva)\
**Replies:** 16\
**Last updated:** [May 27, 2021, 12:08am UTC](https://discourse.julialang.org/t/how-avoid-this-warning-when-i-use-contour/61327 "2021-05-27T00:08:40Z")

</div>

Hello Julia comunity, I need your help. When I run this xs = range(-5,stop=7,length=50) ys = range(-2,stop=12,length=50) contour(xs,ys,h, levels=\[0,2,3,20,30\]) contour!(xs,ys,g, levels=\[-7,-6,-5,-4,-3,-2,-1,-0.5,0\]…

---

## [\`Vararg\` argument as optional argument gives error when there is a keyword argument](https://discourse.julialang.org/t/vararg-argument-as-optional-argument-gives-error-when-there-is-a-keyword-argument/61812)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 3\
**Last updated:** [May 27, 2021, 6:05am UTC](https://discourse.julialang.org/t/vararg-argument-as-optional-argument-gives-error-when-there-is-a-keyword-argument/61812 "2021-05-27T06:05:30Z")

</div>

MWE: julia\> foo(a, b::Array{Int, 1}...=\[0,0\];c="") = @show b foo (generic function with 3 methods) julia\> goo(a,b::Array{Array{Int, 1}, 1}) = begin c = "c" foo(a, b...;c) end goo (generic function …

---

## [Replacing values of specific entries in an Array In Julia](https://discourse.julialang.org/t/replacing-values-of-specific-entries-in-an-array-in-julia/25259)

<div class="topic-metadata">

**Author:** [@jmcastro2109](https://discourse.julialang.org/u/jmcastro2109)\
**Replies:** 10\
**Last updated:** [May 26, 2021, 4:30am UTC](https://discourse.julialang.org/t/replacing-values-of-specific-entries-in-an-array-in-julia/25259 "2021-05-26T04:30:46Z")

</div>

I am wondering about how to implement efficiently a code that replaces some entries of an array with specific values. In other words, I have a matrix and a vector with some indices of the matrix where a logical condition…

---

## [Ismissing(x) versus x === missing](https://discourse.julialang.org/t/ismissing-x-versus-x-missing/52171)

<div class="topic-metadata">

**Author:** [@rikh](https://discourse.julialang.org/u/rikh)\
**Replies:** 15\
**Last updated:** [May 26, 2021, 11:33pm UTC](https://discourse.julialang.org/t/ismissing-x-versus-x-missing/52171 "2021-05-26T23:33:03Z")

</div>

Maybe this is a dumb question, but there seems to be a bit of confusion about using ismissing(x) versus x === missing, and isnothing(x) versus x === nothing at \[ANN\] ShowLint - #3 by Mason. I would say that in both case…

---

## [Multithreading inconsistency issue](https://discourse.julialang.org/t/multithreading-inconsistency-issue/61879)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 4\
**Last updated:** [May 26, 2021, 8:33pm UTC](https://discourse.julialang.org/t/multithreading-inconsistency-issue/61879 "2021-05-26T20:33:09Z")

</div>

The following is a simplified version of a problem I’m working on. I get different answers depending on whether or not I use threads. This has got to be some sort of race condition, but I"m not sure how to straighten i…

---

## [ModelingToolkit with DataInterpolation in time-varying external force](https://discourse.julialang.org/t/modelingtoolkit-with-datainterpolation-in-time-varying-external-force/61859)

<div class="topic-metadata">

**Author:** [@lnacquaroli](https://discourse.julialang.org/u/lnacquaroli)\
**Replies:** 4\
**Last updated:** [May 26, 2021, 6:40pm UTC](https://discourse.julialang.org/t/modelingtoolkit-with-datainterpolation-in-time-varying-external-force/61859 "2021-05-26T18:40:00Z")

</div>

Hi there, I’m trying to get to work the simple example of an ODE with the external varying force with a DataInterpolation function, but I get an error building the ODESystem. The example is as follow: using ModelingTool…

---

## [Keyword Arguments](https://discourse.julialang.org/t/keyword-arguments/61870)

<div class="topic-metadata">

**Author:** [@saraflgarcia](https://discourse.julialang.org/u/saraflgarcia)\
**Replies:** 9\
**Last updated:** [May 26, 2021, 6:31pm UTC](https://discourse.julialang.org/t/keyword-arguments/61870 "2021-05-26T18:31:36Z")

</div>

How do we get the number (and/or name) of keyword arguments of a function? For instance, f(;x, y, z) = x+y+z arguments(f) Thanks!

---

## [Can't create a struct with a macro from a string of types](https://discourse.julialang.org/t/cant-create-a-struct-with-a-macro-from-a-string-of-types/61876)

<div class="topic-metadata">

**Author:** [@emanuellima](https://discourse.julialang.org/u/emanuellima)\
**Replies:** 4\
**Last updated:** [May 26, 2021, 6:15pm UTC](https://discourse.julialang.org/t/cant-create-a-struct-with-a-macro-from-a-string-of-types/61876 "2021-05-26T18:15:04Z")

</div>

Hello. I am trying to create a struct through a macro with types that will be know at runtime. It would work something like this: the user would pass a string “a::A b::B” and the macro would create a struct: struct MySt…

---

## [Lacking keys/values in a dictionary](https://discourse.julialang.org/t/lacking-keys-values-in-a-dictionary/61809)

<div class="topic-metadata">

**Author:** [@bonnkleiford](https://discourse.julialang.org/u/bonnkleiford)\
**Replies:** 2\
**Last updated:** [May 26, 2021, 5:34pm UTC](https://discourse.julialang.org/t/lacking-keys-values-in-a-dictionary/61809 "2021-05-26T17:34:08Z")

</div>

I have 3 dictionaries, A and B: A = Dict("1" =\> 0.1 "3" =\> 0.1 "5" =\> 0.1 "7" =\> 0.1 "9" =\> 0.1 "11" =\> 0.1 "13" =\> 0.1 "15" =\> 0.1 "17" =\> 0.1 "19" =\> 0.1) B = Dict("1" =\> 0.2 "5" =\> 0.1 "…

---

## [Catalyst: weird interaction between user defined functions, arrays and Num](https://discourse.julialang.org/t/catalyst-weird-interaction-between-user-defined-functions-arrays-and-num/61867)

<div class="topic-metadata">

**Author:** [@Alex0](https://discourse.julialang.org/u/Alex0)\
**Replies:** 0\
**Last updated:** [May 26, 2021, 4:18pm UTC](https://discourse.julialang.org/t/catalyst-weird-interaction-between-user-defined-functions-arrays-and-num/61867 "2021-05-26T16:18:19Z")

</div>

Hello everyone, I am currently trying to create a chemical network in Catalyst.jl using my own functions as reaction rates. These functions are provided species of the network as input arguments and then need to use if …

---

## [I'm afraid the searching of the documentation needs a bit of work](https://discourse.julialang.org/t/im-afraid-the-searching-of-the-documentation-needs-a-bit-of-work/61860)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 2\
**Last updated:** [May 26, 2021, 3:01pm UTC](https://discourse.julialang.org/t/im-afraid-the-searching-of-the-documentation-needs-a-bit-of-work/61860 "2021-05-26T15:01:40Z")

</div>

Clearly, I would have appreciated some links that actually refer to Manifest.toml. The first one does not, at all.

---

## [When you don't assign a variable in the inner constructor, how does it get assigned](https://discourse.julialang.org/t/when-you-dont-assign-a-variable-in-the-inner-constructor-how-does-it-get-assigned/61852)

<div class="topic-metadata">

**Author:** [@anon60034542](https://discourse.julialang.org/u/anon60034542)\
**Replies:** 7\
**Last updated:** [May 26, 2021, 2:49pm UTC](https://discourse.julialang.org/t/when-you-dont-assign-a-variable-in-the-inner-constructor-how-does-it-get-assigned/61852 "2021-05-26T14:49:55Z")

</div>

Consider the following code: struct Employee ID::Int32 name::String end and I can create an object and call any field: svetlana = Employee(1,"Queen Svetlana") println(svetlana.name) If I require validation, …

---

## [Julia Interop / FFI / Smalltalk](https://discourse.julialang.org/t/julia-interop-ffi-smalltalk/61854)

<div class="topic-metadata">

**Author:** [@threadedblue](https://discourse.julialang.org/u/threadedblue)\
**Replies:** 2\
**Last updated:** [May 26, 2021, 2:06pm UTC](https://discourse.julialang.org/t/julia-interop-ffi-smalltalk/61854 "2021-05-26T14:06:10Z")

</div>

I have come up with a need to call Julia from–wait for it–SmallTalk. If you are familiar with Pharo or Squeak, that’s where I want to call from–mostly from Pharo. I see that Pharo supports FFI, but the docs focus mostl…

---

## [Nagging coverage question](https://discourse.julialang.org/t/nagging-coverage-question/61821)

<div class="topic-metadata">

**Author:** [@bramtayl](https://discourse.julialang.org/u/bramtayl)\
**Replies:** 1\
**Last updated:** [May 26, 2021, 1:51pm UTC](https://discourse.julialang.org/t/nagging-coverage-question/61821 "2021-05-26T13:51:54Z")

</div>

Ok, so, compare the following two macros: macro adds\_more\_lines\_1() quote nothing end end macro adds\_more\_lines\_2() result = quote nothing end result.args\[1\] = \_\_source\_\_ …

---

## [How to increase gap between axis title and axis in PlotlyJS?](https://discourse.julialang.org/t/how-to-increase-gap-between-axis-title-and-axis-in-plotlyjs/61798)

<div class="topic-metadata">

**Author:** [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Replies:** 3\
**Last updated:** [May 26, 2021, 10:16am UTC](https://discourse.julialang.org/t/how-to-increase-gap-between-axis-title-and-axis-in-plotlyjs/61798 "2021-05-26T10:16:07Z")

</div>

Is there any parameter in PlotlyBase to set the gap between title of axis and axis. Typically with log scaled axis my axis title (for y axis) is overlapping with “numbers”.

---

## [I don't understand this bug](https://discourse.julialang.org/t/i-dont-understand-this-bug/61789)

<div class="topic-metadata">

**Author:** [@Scarlov](https://discourse.julialang.org/u/Scarlov)\
**Replies:** 12\
**Last updated:** [May 25, 2021, 8:00pm UTC](https://discourse.julialang.org/t/i-dont-understand-this-bug/61789 "2021-05-25T20:00:50Z")

</div>

When I run this code: using Printf function choose\_best\_sum(t, k, ls) ran = range(1, length(ls), step = 1) choices = unique!(\[sort(\[ls\[i\], ls\[j\], ls\[m\]\]) for i in ran for j in ran for m in ran if( i != j && j !…

---

## [Contiguous setindex involving an adjoint is slower than non-contiguous for a Matrix](https://discourse.julialang.org/t/contiguous-setindex-involving-an-adjoint-is-slower-than-non-contiguous-for-a-matrix/61767)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 5\
**Last updated:** [May 25, 2021, 7:37pm UTC](https://discourse.julialang.org/t/contiguous-setindex-involving-an-adjoint-is-slower-than-non-contiguous-for-a-matrix/61767 "2021-05-25T19:37:28Z")

</div>

julia\> a = zeros(500,500); julia\> b = zeros(500,500)'; julia\> v = 1:500; julia\> @btime $a\[1,:\] = $v; 711.515 ns (0 allocations: 0 bytes) julia\> @btime $b\[1,:\] = $v; 808.444 ns (0 allocations: 0 bytes) julia\> @bt…

---

## [Macro defining an internal macro?](https://discourse.julialang.org/t/macro-defining-an-internal-macro/61700)

<div class="topic-metadata">

**Author:** [@Mark\_Nahabedian](https://discourse.julialang.org/u/Mark_Nahabedian)\
**Replies:** 10\
**Last updated:** [May 25, 2021, 5:41pm UTC](https://discourse.julialang.org/t/macro-defining-an-internal-macro/61700 "2021-05-25T17:41:45Z")

</div>

I need some help with macros. I have a directed graph that is represented by a collection of Pairs where each Pair represents an arc of the graph. I want to perform some transformations on the graph. Each transformati…

---

## [Loading another package when loading a package](https://discourse.julialang.org/t/loading-another-package-when-loading-a-package/61795)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 1\
**Last updated:** [May 25, 2021, 5:03pm UTC](https://discourse.julialang.org/t/loading-another-package-when-loading-a-package/61795 "2021-05-25T17:03:36Z")

</div>

Hi, Is there a way to load packageA when I load packageB? Example, if I do using packageB Then packageA is also available. Thank you

---

## [Code fails in jupyter notebook, but succeeds in REPL](https://discourse.julialang.org/t/code-fails-in-jupyter-notebook-but-succeeds-in-repl/61793)

<div class="topic-metadata">

**Author:** [@PeterVincent96](https://discourse.julialang.org/u/PeterVincent96)\
**Replies:** 0\
**Last updated:** [May 25, 2021, 4:40pm UTC](https://discourse.julialang.org/t/code-fails-in-jupyter-notebook-but-succeeds-in-repl/61793 "2021-05-25T16:40:31Z")

</div>

I have the following code using Statistics using LinearAlgebra using ForwardDiff using Plots plotlyjs() ENV\["JULIA\_REVISE\_POLL"\] = "1" using Revise using Distributions using DelimitedFiles include("path/to/files.jl") d…

---

## [Weird behavior: \`UndefVarError:\` module function needs to be called with ModuleName.function](https://discourse.julialang.org/t/weird-behavior-undefvarerror-module-function-needs-to-be-called-with-modulename-function/61790)

<div class="topic-metadata">

**Author:** [@cdawg](https://discourse.julialang.org/u/cdawg)\
**Replies:** 2\
**Last updated:** [May 25, 2021, 4:34pm UTC](https://discourse.julialang.org/t/weird-behavior-undefvarerror-module-function-needs-to-be-called-with-modulename-function/61790 "2021-05-25T16:34:31Z")

</div>

This has come up a couple times for me but I’m daunted by the idea of getting an MRE because it is rare. I write a non-exported helper function or method extension inside a module and it is undefined unless I call it wi…

---

## [Troubles with SimJulia Doc](https://discourse.julialang.org/t/troubles-with-simjulia-doc/41855)

<div class="topic-metadata">

**Author:** [@ameresv](https://discourse.julialang.org/u/ameresv)\
**Replies:** 4\
**Last updated:** [May 25, 2021, 3:40pm UTC](https://discourse.julialang.org/t/troubles-with-simjulia-doc/41855 "2021-05-25T15:40:04Z")

</div>

Hi! I am reading the SimJulia documentation in order to know more about the capabilities of the package. However, when I run it, an error message appears: using SimJulia function car(env::Environment) while true …

---

## [Do you have a clean way of looping through an array?](https://discourse.julialang.org/t/do-you-have-a-clean-way-of-looping-through-an-array/61788)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 6\
**Last updated:** [May 25, 2021, 3:38pm UTC](https://discourse.julialang.org/t/do-you-have-a-clean-way-of-looping-through-an-array/61788 "2021-05-25T15:38:25Z")

</div>

Post it here. And when I say clean, it doesn’t mean clever. (I usually find that the clever ways of doing things are not the most legible.)

---

## [Performance of \`Union{Missing,Float64}\`](https://discourse.julialang.org/t/performance-of-union-missing-float64/16348)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 14\
**Last updated:** [May 25, 2021, 2:47pm UTC](https://discourse.julialang.org/t/performance-of-union-missing-float64/16348 "2021-05-25T14:47:04Z")

</div>

From https://julialang.org/blog/2018/06/missing: For example, missing values still have a significant performance impact for arrays of Float64 elements, which are essential for numeric computing. function sum\_nonmis…

---

## [Specifying index without access to array](https://discourse.julialang.org/t/specifying-index-without-access-to-array/61693)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 9\
**Last updated:** [May 25, 2021, 2:35pm UTC](https://discourse.julialang.org/t/specifying-index-without-access-to-array/61693 "2021-05-25T14:35:31Z")

</div>

In Python, I can get the the second-to-last value of an array using a nice syntax: \>\>\> ix = -2 \>\>\> lst = \[10, 20, 30, 40\] \>\>\> lst\[ix\] 30 but I can’t do this in Julia: julia\> lst = \[10, 20, 30, 40\]; julia\> ix = end - 2…

---

## [Update vector without using a counter in a multithreaded loop](https://discourse.julialang.org/t/update-vector-without-using-a-counter-in-a-multithreaded-loop/61776)

<div class="topic-metadata">

**Author:** [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Replies:** 4\
**Last updated:** [May 25, 2021, 2:28pm UTC](https://discourse.julialang.org/t/update-vector-without-using-a-counter-in-a-multithreaded-loop/61776 "2021-05-25T14:28:24Z")

</div>

I would like to convert the following simplified example: n=10 x = Vector{Float64}(undef,n) y = 1:10 Threads.@threads for i=1:length(y) x\[i\] = y\[i\] \* 2.0 end into: n=10 x = Vector{Float64}(undef,n) y = 1:10 Thread…

---

## [A subtle bug?](https://discourse.julialang.org/t/a-subtle-bug/61725)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 21\
**Last updated:** [May 25, 2021, 1:45pm UTC](https://discourse.julialang.org/t/a-subtle-bug/61725 "2021-05-25T13:45:59Z")

</div>

I got a Float64 number from the p-value of a GLM model. I could NOT show the fitted model with the following error: ERROR: p-values must be in \[0; 1\] Stacktrace: \[1\] error(::String) at ./error.jl:33 \[2\] StatsBase.PVa…

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

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