# General Usage

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

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

**Page:** 175

---

## [Inserting image in corner of plot without affecting aspect ratio](https://discourse.julialang.org/t/inserting-image-in-corner-of-plot-without-affecting-aspect-ratio/113631)

<div class="topic-metadata">

**Author:** [@hshackle](https://discourse.julialang.org/u/hshackle)\
**Replies:** 2\
**Last updated:** [April 30, 2024, 1:47am UTC](https://discourse.julialang.org/t/inserting-image-in-corner-of-plot-without-affecting-aspect-ratio/113631 "2024-04-30T01:47:00Z")

</div>

I have a png image that I would like to include in the corner of a plot. It seems that there is functionality for putting images in plots, but I could not find an easy way of doing what I wanted. Below is an example: us…

---

## [Blank plots in Julia 1.6+ and GR 0.57.4](https://discourse.julialang.org/t/blank-plots-in-julia-1-6-and-gr-0-57-4/59993)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 7\
**Last updated:** [April 29, 2024, 10:09pm UTC](https://discourse.julialang.org/t/blank-plots-in-julia-1-6-and-gr-0-57-4/59993 "2024-04-29T22:09:53Z")

</div>

I am getting completely blank plots since I updated Plots to 1.12 in Julia 1.6. I also installed 1.6.1 and added Plots, with the same result: The output of \]st is below, in any case. Anyone has any idea of what can b…

---

## [How to make \`\[0\] == 0\`?](https://discourse.julialang.org/t/how-to-make-0-0/112630)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 24\
**Last updated:** [April 29, 2024, 6:13pm UTC](https://discourse.julialang.org/t/how-to-make-0-0/112630 "2024-04-29T18:13:14Z")

</div>

julia\> 2 .- \[1 1\] \* \[1; 1\] == 0 false This means in Julia \[0\] != 0. Although I can understand this rule, I feel it inconvenient to use. Do I have to build awareness of this kind and to code carefully when using Julia, o…

---

## [Is there a linestyle vector in PyPlot?](https://discourse.julialang.org/t/is-there-a-linestyle-vector-in-pyplot/113619)

<div class="topic-metadata">

**Author:** [@marllos](https://discourse.julialang.org/u/marllos)\
**Replies:** 2\
**Last updated:** [April 29, 2024, 6:12pm UTC](https://discourse.julialang.org/t/is-there-a-linestyle-vector-in-pyplot/113619 "2024-04-29T18:12:13Z")

</div>

Is it possible to do something like plot(xy\[:,1\], xy\[:,2:end\], linestyle=\[“-”,“–”\]), using PyPlot?

---

## [Type stability of vector of matrices](https://discourse.julialang.org/t/type-stability-of-vector-of-matrices/113615)

<div class="topic-metadata">

**Author:** [@araujoms](https://discourse.julialang.org/u/araujoms)\
**Replies:** 4\
**Last updated:** [April 29, 2024, 5:52pm UTC](https://discourse.julialang.org/t/type-stability-of-vector-of-matrices/113615 "2024-04-29T17:52:57Z")

</div>

I’m puzzled by why the following function is type unstable: function unstable(d, T) return \[zeros(T,d,d) for \_ = 1:d\] end I got this by debugging a much more complicated function that had terrible performance; the …

---

## [Subtracting mean from DataFrame column: Why so many allocations?](https://discourse.julialang.org/t/subtracting-mean-from-dataframe-column-why-so-many-allocations/113607)

<div class="topic-metadata">

**Author:** [@JWMeer](https://discourse.julialang.org/u/JWMeer)\
**Replies:** 5\
**Last updated:** [April 29, 2024, 3:09pm UTC](https://discourse.julialang.org/t/subtracting-mean-from-dataframe-column-why-so-many-allocations/113607 "2024-04-29T15:09:57Z")

</div>

Consider the following DataFrame: df = DataFrame() df.a = repeat(1:1000, outer = 1000) df.b = rand(1000 \* 1000) This DataFrame consists of 1000 groups (grouped by a) of 1000 values each (stored in b). For each group, I…

---

## [EDF.jl package: Finding sample rate of a signal](https://discourse.julialang.org/t/edf-jl-package-finding-sample-rate-of-a-signal/113610)

<div class="topic-metadata">

**Author:** [@Santiago\_Lopez](https://discourse.julialang.org/u/Santiago_Lopez)\
**Replies:** 1\
**Last updated:** [April 29, 2024, 1:19pm UTC](https://discourse.julialang.org/t/edf-jl-package-finding-sample-rate-of-a-signal/113610 "2024-04-29T13:19:39Z")

</div>

In other languages (e.g. Python and R), packages for reading EDF files typically include the capacity to extract the sampling rate of a signal. This doesn’t seem to be possible in the EDF.jl package. My two questions are…

---

## [Debugging type-instability allocations with ForwardDiff](https://discourse.julialang.org/t/debugging-type-instability-allocations-with-forwarddiff/113591)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 12\
**Last updated:** [April 29, 2024, 10:58am UTC](https://discourse.julialang.org/t/debugging-type-instability-allocations-with-forwarddiff/113591 "2024-04-29T10:58:21Z")

</div>

I’m really struggling with my ForwardDiff.jl bindings for DifferentiationInterface.jl. The goal is to achieve an allocation-free Jacobian-vector product (aka pushforward) for functions of the form f!(y, x). I have succe…

---

## [Can the fields of a Julia type have default values?](https://discourse.julialang.org/t/can-the-fields-of-a-julia-type-have-default-values/113601)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 4\
**Last updated:** [April 29, 2024, 6:35am UTC](https://discourse.julialang.org/t/can-the-fields-of-a-julia-type-have-default-values/113601 "2024-04-29T06:35:51Z")

</div>

julia\> struct MyType n::Int64 end julia\> a = MyType(3) MyType(3) julia\> a.n 3 julia\> b = MyType() ERROR: MethodError: no method matching MyType() Can I set a default number for the field n (e.g., n = 1 by default) so…

---

## [Loading R packages not working anymore after updating R](https://discourse.julialang.org/t/loading-r-packages-not-working-anymore-after-updating-r/113592)

<div class="topic-metadata">

**Author:** [@Hugo](https://discourse.julialang.org/u/Hugo)\
**Replies:** 2\
**Last updated:** [April 28, 2024, 9:54pm UTC](https://discourse.julialang.org/t/loading-r-packages-not-working-anymore-after-updating-r/113592 "2024-04-28T21:54:11Z")

</div>

For a while, I had been calling R functionalities from my Julia code successfully with package RCall. Recently, however, I updated the version of my R installation, and now it seems the Julia code is broken. I should say…

---

## [Makie fails in my script but work in MWE](https://discourse.julialang.org/t/makie-fails-in-my-script-but-work-in-mwe/113594)

<div class="topic-metadata">

**Author:** [@TimG](https://discourse.julialang.org/u/TimG)\
**Replies:** 2\
**Last updated:** [April 28, 2024, 9:42pm UTC](https://discourse.julialang.org/t/makie-fails-in-my-script-but-work-in-mwe/113594 "2024-04-28T21:42:36Z")

</div>

I have an MWE as follows: using DataFrames import CairoMakie as Mke plotdf = DataFrame( nla=Int\[1, 2, 3, 4, 5, 6\], newLocalAuthority=String\["Liverpool", "Knowsley", "St. Helens", "Sefton", "Wirral", "Halton"\], …

---

## [Reducing getfield overhead?](https://discourse.julialang.org/t/reducing-getfield-overhead/113585)

<div class="topic-metadata">

**Author:** [@vavrines](https://discourse.julialang.org/u/vavrines)\
**Replies:** 2\
**Last updated:** [April 28, 2024, 8:51pm UTC](https://discourse.julialang.org/t/reducing-getfield-overhead/113585 "2024-04-28T20:51:08Z")

</div>

A MWE: using BenchmarkTools struct Get\_Field\_Test x::Vector{Float64} y::Vector{Float64} end ts = Vector{Get\_Field\_Test}(undef, 1000) for i in 1:1000 ts\[i\] = Get\_Field\_Test(rand(100), rand(100)) end functi…

---

## [Problem with LinearSolve.jl and PardisoJL()](https://discourse.julialang.org/t/problem-with-linearsolve-jl-and-pardisojl/113595)

<div class="topic-metadata">

**Author:** [@MichelJuillard](https://discourse.julialang.org/u/MichelJuillard)\
**Replies:** 2\
**Last updated:** [April 28, 2024, 8:27pm UTC](https://discourse.julialang.org/t/problem-with-linearsolve-jl-and-pardisojl/113595 "2024-04-28T20:27:15Z")

</div>

I encounter a problem using LinearSolve to solve a sparse linear system with PardisoJL(): The test case, test\_PardisoJL.jl: using Pkg Pkg.activate(; temp=true) Pkg.add("LinearSolve") Pkg.add("Pardiso") using LinearAlg…

---

## [Testing an api wrapper](https://discourse.julialang.org/t/testing-an-api-wrapper/111140)

<div class="topic-metadata">

**Author:** [@knbrt](https://discourse.julialang.org/u/knbrt)\
**Replies:** 1\
**Last updated:** [April 28, 2024, 5:11pm UTC](https://discourse.julialang.org/t/testing-an-api-wrapper/111140 "2024-04-28T17:11:21Z")

</div>

Hi there, currently I’m trying to write tests for an api wrapper I created. Of course I don’t want to actually call the RestAPI during testing. Luckily I discovered BrokenRecord.jl which is working nicely. But unfortunat…

---

## [Activating test dependencies?](https://discourse.julialang.org/t/activating-test-dependencies/48121)

<div class="topic-metadata">

**Author:** [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Replies:** 11\
**Last updated:** [February 21, 2022, 10:03am UTC](https://discourse.julialang.org/t/activating-test-dependencies/48121 "2022-02-21T10:03:09Z")

</div>

Is it possible to activate the extras/test dependencies of a project, e.g. for running tests manually/interactively (instead via Pkg.test())?

---

## [Error: failed to evaluate \`Modules =](https://discourse.julialang.org/t/error-failed-to-evaluate-modules/113583)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 5\
**Last updated:** [April 28, 2024, 2:23pm UTC](https://discourse.julialang.org/t/error-failed-to-evaluate-modules/113583 "2024-04-28T14:23:19Z")

</div>

I have a docs page with this autodocs field (without the comments): #\`\`\`@autodocs Modules = \[MolSimToolkit.Reweighting\] Pages = \["Reweighting/reweighting.jl"\] Order = \[:function, :type\] #\`\`\` The module Reweighting is i…

---

## [How to append the docstring of a type or function in the upstream package in a downstream package](https://discourse.julialang.org/t/how-to-append-the-docstring-of-a-type-or-function-in-the-upstream-package-in-a-downstream-package/113418)

<div class="topic-metadata">

**Author:** [@kimikage](https://discourse.julialang.org/u/kimikage)\
**Replies:** 2\
**Last updated:** [April 28, 2024, 9:41am UTC](https://discourse.julialang.org/t/how-to-append-the-docstring-of-a-type-or-function-in-the-upstream-package-in-a-downstream-package/113418 "2024-04-28T09:41:06Z")

</div>

As an example, consider developing a downstream package like SpecificFoo.jl using upstream packages which provide APIs like FooBase.jl/FooCore.jl. We can write a docstring for the method defined in the downstream packag…

---

## [Data representation in StaticCompiler](https://discourse.julialang.org/t/data-representation-in-staticcompiler/113038)

<div class="topic-metadata">

**Author:** [@Thomas008](https://discourse.julialang.org/u/Thomas008)\
**Replies:** 3\
**Last updated:** [April 28, 2024, 8:46am UTC](https://discourse.julialang.org/t/data-representation-in-staticcompiler/113038 "2024-04-28T08:46:20Z")

</div>

I want to represent float numbers, integers and strings in a DataFrame or similar representation. I’d like to compile this with help of StaticCompiler to produce small executable binaries. How can I represent these data…

---

## [Performance discrepancy with multiple dispatch](https://discourse.julialang.org/t/performance-discrepancy-with-multiple-dispatch/113556)

<div class="topic-metadata">

**Author:** [@Albert\_de\_montserrat](https://discourse.julialang.org/u/Albert_de_montserrat)\
**Replies:** 4\
**Last updated:** [April 27, 2024, 11:07pm UTC](https://discourse.julialang.org/t/performance-discrepancy-with-multiple-dispatch/113556 "2024-04-27T23:07:26Z")

</div>

I am having problems trying to understand the difference in performance between the two foo methods described below. using Chairmarks abstract type AbstractTrait end struct ConcreteTrait \<: AbstractTrait end foo(::Arra…

---

## [Kwdef and empty constructor](https://discourse.julialang.org/t/kwdef-and-empty-constructor/113553)

<div class="topic-metadata">

**Author:** [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Replies:** 2\
**Last updated:** [April 28, 2024, 1:40am UTC](https://discourse.julialang.org/t/kwdef-and-empty-constructor/113553 "2024-04-28T01:40:18Z")

</div>

My code has a section analogous to: Base.@kwdef struct A a::Int end A() = A(a=1) This appeared to work well (Julia 1.9.2), but when I moved my code to a local package and started using \] dev and Revise, I received a…

---

## [Are \`Int64\` and \`Float64\` of the same type?](https://discourse.julialang.org/t/are-int64-and-float64-of-the-same-type/113574)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 5\
**Last updated:** [April 27, 2024, 10:22pm UTC](https://discourse.julialang.org/t/are-int64-and-float64-of-the-same-type/113574 "2024-04-27T22:22:46Z")

</div>

typeof(Int64) and typeof(Float64) are both DataType, but Int64 isa Type{Int64} while !(Float64 isa Type{Int64}) and I would expect nothing besides the type of a value be utilized in the isa opperation. So I ask, are Int6…

---

## [How to display a sparse array on the REPL?](https://discourse.julialang.org/t/how-to-display-a-sparse-array-on-the-repl/113565)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 5\
**Last updated:** [April 27, 2024, 1:49pm UTC](https://discourse.julialang.org/t/how-to-display-a-sparse-array-on-the-repl/113565 "2024-04-27T13:49:07Z")

</div>

If I construct a sparse matrix on the REPL, it can directly display the distribution of non-zero elements of the matrix: julia\> using SparseArrays julia\> sparse(round.(rand(5,5))) 5×5 SparseMatrixCSC{Float64, Int64} wi…

---

## [Is it possible to preserve compilation cache from julia process to julia process?](https://discourse.julialang.org/t/is-it-possible-to-preserve-compilation-cache-from-julia-process-to-julia-process/113488)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 9\
**Last updated:** [April 27, 2024, 1:47am UTC](https://discourse.julialang.org/t/is-it-possible-to-preserve-compilation-cache-from-julia-process-to-julia-process/113488 "2024-04-27T01:47:12Z")

</div>

Hi there, my aim is to speed up my julia development environment. I am already using \_\_precompile\_\_(false) for my developed package and Revise as much as possible, but if the julia process restarts, it really takes long…

---

## [Semantics of constant folding for type constructors](https://discourse.julialang.org/t/semantics-of-constant-folding-for-type-constructors/113528)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 2\
**Last updated:** [April 27, 2024, 12:27am UTC](https://discourse.julialang.org/t/semantics-of-constant-folding-for-type-constructors/113528 "2024-04-27T00:27:27Z")

</div>

I would like to expose an API in a package to the users as a simple set of parametric (singleton) types, with internally calculated parameters, using the smallest set of symbols as possible, without exposing type constru…

---

## [Try-Catch online help](https://discourse.julialang.org/t/try-catch-online-help/113532)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 2\
**Last updated:** [April 26, 2024, 1:56pm UTC](https://discourse.julialang.org/t/try-catch-online-help/113532 "2024-04-26T13:56:47Z")

</div>

Within the Julia REPL I typed ?try. I found no reference to the finally clause. Same for ?catch. Typing ?finally does give information but the help on try should inform the user that the finally option exists. Then w…

---

## [Getting ForwardDiff jacobian! to execute with zero allocations](https://discourse.julialang.org/t/getting-forwarddiff-jacobian-to-execute-with-zero-allocations/72503)

<div class="topic-metadata">

**Author:** [@Anthony](https://discourse.julialang.org/u/Anthony)\
**Replies:** 9\
**Last updated:** [April 26, 2024, 12:35pm UTC](https://discourse.julialang.org/t/getting-forwarddiff-jacobian-to-execute-with-zero-allocations/72503 "2024-04-26T12:35:35Z")

</div>

I’ve been trying (so far unsuccessfully) to figure out how to execute ForwardDiff’s jacobian! function such that it will not perform additional allocations once compiled. However, I’ve been unable to figure out how to ac…

---

## [Least squares with SciML NonlinearSolve.jl - how to?](https://discourse.julialang.org/t/least-squares-with-sciml-nonlinearsolve-jl-how-to/113074)

<div class="topic-metadata">

**Author:** [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Replies:** 13\
**Last updated:** [April 18, 2024, 9:18pm UTC](https://discourse.julialang.org/t/least-squares-with-sciml-nonlinearsolve-jl-how-to/113074 "2024-04-18T21:18:28Z")

</div>

Trying to get how to use it - reading Documentation unfortunately doesn’t help. The use case - a model described by a formula, and a vector of (t, y) value pairs representing e.g. experimental data. Like the example pro…

---

## [What is the “standard” way to use multi-threading with dot-calls (vectorized/broadcast)?](https://discourse.julialang.org/t/what-is-the-standard-way-to-use-multi-threading-with-dot-calls-vectorized-broadcast/113473)

<div class="topic-metadata">

**Author:** [@lmtzx9h4qqnt](https://discourse.julialang.org/u/lmtzx9h4qqnt)\
**Replies:** 5\
**Last updated:** [April 26, 2024, 4:47am UTC](https://discourse.julialang.org/t/what-is-the-standard-way-to-use-multi-threading-with-dot-calls-vectorized-broadcast/113473 "2024-04-26T04:47:10Z")

</div>

All the discussions I’ve found on this topic are years old: “Multithreaded broadcast?” thread use multiple threads in vectorized operations · Issue #1802 · JuliaLang/julia · GitHub multi-threaded (@threads) dotcall/bro…

---

## [Can a module in a package itself be a package?](https://discourse.julialang.org/t/can-a-module-in-a-package-itself-be-a-package/113474)

<div class="topic-metadata">

**Author:** [@sadish-d](https://discourse.julialang.org/u/sadish-d)\
**Replies:** 8\
**Last updated:** [April 26, 2024, 4:02am UTC](https://discourse.julialang.org/t/can-a-module-in-a-package-itself-be-a-package/113474 "2024-04-26T04:02:35Z")

</div>

I have a pacakge (PackageCore) that provides the main functionality of another (PackageFull). I’ve decided that I want to be able to develop and test these as independent packages. This is the structure I am currently us…

---

## [Dataframes: displaying categorical key when displaying a dataframe while saving the value in the data array](https://discourse.julialang.org/t/dataframes-displaying-categorical-key-when-displaying-a-dataframe-while-saving-the-value-in-the-data-array/113470)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 13\
**Last updated:** [April 25, 2024, 9:07pm UTC](https://discourse.julialang.org/t/dataframes-displaying-categorical-key-when-displaying-a-dataframe-while-saving-the-value-in-the-data-array/113470 "2024-04-25T21:07:53Z")

</div>

I have a question about displaying categorical data in a dataframe. I want to see if there is a way to display the categorical key value, while preserving the categorical value in the data. The point is to help users wo…

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

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